from Tkinter import *
def dibujo(ventana):
panel = Canvas(width=225, height=200, bg="white")
panel.pack()
# Parte negra
panel.create_polygon(70, 10, 170, 10, 170, 20, 190, 20, 190, 30, 200, 30, 200, 80, 190, 80, 190, 90, 170, 90, 170, 100, 140, 100, 140, 120, 150, 120, 150, 110, 170, 110, 170, 100, 190, 100, 190, 110, 200, 110, 200, 140, 190, 140, 190, 150, 180, 150, 180, 160, 160, 160, 160, 170, 80, 170, 80, 160, 60, 160, 60, 150, 50, 150, 50, 140, 40, 140, 40, 110, 50, 110, 50, 100, 70, 100, 70, 110, 90, 110, 90, 120, 100, 120, 100, 100, 70, 100, 70, 90, 50, 90, 50, 80, 40, 80, 40, 30, 50, 30, 50, 20, 70, 20, 70, 10, width=1, fill="black",outline="black")
# Parte naranja
panel.create_polygon(80, 20, 160, 20, 160, 30, 180, 30, 180, 40, 190, 40, 190, 70, 180, 70, 180, 80, 160, 80, 160, 90, 80, 90, 80, 80, 60, 80, 60, 70, 50, 70, 50, 40, 60, 40, 60, 30, 80, 30, 80, 20, width=1, fill="orange",outline="orange")
# Parte amarilla
panel.create_polygon(90, 30, 150, 30, 150, 40, 170, 40, 170, 70, 150, 70, 150, 80, 90, 80, 90, 70, 70, 70, 70, 40, 90, 40, 90, 30, width=1, fill="yellow",outline="yellow")
# Parte blanca
panel.create_polygon(90, 50, 150, 50, 150, 60, 90, 60, 90, 50, width=1, fill="white",outline="white")
#Ojos rectangulos negros
panel.create_rectangle(100, 40, 110, 70, width=1, fill="black",outline="black")
panel.create_rectangle(130, 40, 140, 70, width=1, fill="black",outline="black")
#Parte verde
panel.create_polygon(110, 100, 130, 100, 130, 150, 140, 150, 140, 130, 150, 130, 150, 120, 170, 120, 170, 110, 190, 110, 190, 140, 180, 140, 180, 150, 160, 150, 160, 160, 80, 160, 80, 150, 60, 150, 60, 140, 50, 140, 50, 110, 70, 110, 70, 120, 90, 120, 90, 130, 100, 130, 100, 150, 110, 150, 110, 100, width=1, fill="green",outline="green")
ventana =Tk()
ventana.title("Dibujo en ventana")
ventana.config(bg="white")
ventana.geometry("300x300")
boton = Button(ventana, text="Presione para crear poligono", command=lambda: dibujo(ventana) )
boton.pack()
ventana.mainloop()
miércoles, 3 de octubre de 2018
Poligono en Pycharm
Codigo:
Suscribirse a:
Comentarios de la entrada (Atom)
Unidad 4: Triangulo y cubo en 3D
Sintaxos del programa triangulo 3d: import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * vert...
-
Video fuente del programa: Sintaxis del programa: class operaciones: def __init__(self,num1,num2): self.num1 =num1 ...
-
Entrar al simbolo del sistema(cmd). Utilizamos la variable de entorno para abrir Python Estando dentro del interprete escribimos el s...
-
Dentro del salon de clases ya hemos visto la impleentacion de estos objetos y metodos, pero ahora lo analisaremos un poco mejor. Sintaxis...

No hay comentarios.:
Publicar un comentario