Poligono Venom


from tkinter import *


def dibujo(ventana2):
    panel = Canvas(width=200, height=200, bg="gray")
    panel.pack()

    # Primera parte negra
    panel.create_polygon(70,50,70, 60, 50, 60, 50,70, 40, 70, 40, 150, 50,150, 50, 160,60, 160, 60, 170, 80, 170, 80, 180,
                         110, 180, 110, 170, 130, 170, 130, 160, 140, 160, 140, 150, 150, 150, 150, 70,
                         140, 70, 140, 60, 120, 60, 120, 50, 70, 50, width=1, fill="black")

    # ojo 1
    panel.create_polygon(50, 80, 50 , 120, 60, 120, 60, 130, 80, 130, 80, 120, 90, 120, 90, 110, 80, 110, 80, 100, 70, 100, 70, 90
    , 60, 90, 60, 80, 50, 80, width=1, fill="white")

# ojo 2
    panel.create_polygon(140, 80, 130,80 , 130, 90, 120, 90, 120, 100, 110, 100, 110, 110, 100, 110, 100, 120, 110, 130, 130, 130, 130, 120
    , 140, 120, 140, 80, 130, 80, width=1, fill="white")
ventana2 = Tk()
ventana2.title("Dibujo en ventana")
ventana2.geometry("300x300")
boton = Button(ventana2, text="Mostrar poligono", command=lambda: dibujo(ventana2))
boton.pack()
ventana2.mainloop()



Comentarios

Entradas populares