miércoles, 27 de septiembre de 2017

Código poligono

def figura():
    puntos = [226, 42, 198, 42, 170, 50, 141, 71, 127, 60, 108, 52, 94, 57, 85, 71,              85, 85, 95, 99, 108, 106, 120, 109, 127, 113, 127, 123, 142, 119, 161,              119, 178, 122, 189, 134, 192, 148, 189, 161, 176, 166, 160, 165, 142, 162,              156, 178, 170, 192, 192, 198, 207, 198, 198, 212, 170, 209, 151, 205, 132,              202, 113, 195, 108, 180, 99, 164, 80, 153, 57, 156, 38, 170, 34, 183, 35, 198,              42, 212, 56, 221, 71, 226, 85, 221, 104, 212, 127, 223, 152, 226, 175, 232, 189,              234, 184, 250, 184, 270, 184, 283, 190, 297, 196, 306, 184, 321, 180, 334,              178, 346, 180, 353, 188, 372, 212, 390, 194, 402, 181, 411, 170, 425, 170, 443,              176, 456, 190, 467, 208, 468, 227, 456, 275, 419, 276, 404, 269, 393, 252, 383, 236, 382, 221,              371, 206, 361, 201, 350, 203, 340, 209, 333, 221, 326, 237, 326, 255, 322, 270, 314,              280, 305, 297, 291, 311, 288, 335, 288, 354, 293, 368, 301, 378, 311, 386, 326, 403, 330, 411, 330, 462,              265, 461, 240, 450, 230, 435, 226, 421, 226, 406, 230, 396, 240, 380, 270, 354, 265, 332, 260, 311, 263,              297,263, 283, 263, 278, 250, 264, 226, 283, 226, 297, 221, 312, 212, 330, 198, 346, 198, 363, 198, 375, 188,              382, 175,386, 160, 382, 141, 362, 127, 334, 127, 326, 133, 312, 148, 312, 163, 315, 180, 304, 192, 290, 204, 273,              206, 255,205, 241, 204, 234, 198, 255, 189, 269, 180, 278, 166, 286, 151, 291, 132, 292, 113, 289, 99, 283, 85,              280, 74, 269, 63, 255, 51, 234, 42]
    v1 = Toplevel(v0)
    v1.deiconify()
    figura = Canvas(v1, width=500, height=500, bg='white')
    figura.pack(expand=YES, fill=BOTH)
    figura.create_polygon(puntos, fill="black", outline="white", width=6)
    b4 = Button(v1, text="Cerrar figura", command=lambda: v1.destroy())
    b4.pack()

No hay comentarios:

Publicar un comentario