1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | from Tkinter import * def funcion(select, poligonos): ventana = Toplevel() ventana.configure(bg="gray") ventana.title(Menu poligonos) if select == 1: panel = Canvas(ventana,width=300, height=300, bg='light blue') panel.pack() panel.create_polygon(20, 20, 20, 40, 50, 40, 50, 70, 30, 70, 30, 80, 20, 80, 20, 100, 50, 100, 80, 90, 100, 90, 110, 100, 130, 100, 140, 90, 160, 90, 170, 100, 180, 100, 180, 110, 200, 110, 190, 100, 190, 60, 200, 60, 200, 50, 150, 50, 150, 40, 160, 40, 160, 30, 130, 30, 130, 40, 140, 40, 140, 50, 100, 50, 100, 20, fill='brown', outline='white') # rueda1 panel.create_oval(60, 90, 110, 120, fill='black', outline='black') # rueda2 panel.create_oval(120, 90, 170, 120, fill='black', outline='black') # ventana panel.create_rectangle(60, 40, 80, 60, fill='black', outline='black') # humo panel.create_oval(140, 10, 150, 20, fill='black', outline='black') # humo2 panel.create_oval(120, 10, 130, 20, fill='black', outline='black') # humo2 panel.create_oval(110, 10, 120, 20, fill='black', outline='black') elif select == 2: panel = Canvas(ventana,width=1400, height=1400, bg='light blue') # Cuadrado grande panel.create_rectangle(300, 200, 800, 600, fill='black', outline='black') # ventana 1 panel.create_rectangle(300, 200, 500, 400, fill='white', outline='black') # ventan 2 panel.create_rectangle(600, 200, 800, 400, fill='white', outline='black') # puerta panel.create_rectangle(500, 500, 600, 600, fill='red', outline='black') # Trapecio techo panel.create_polygon(300, 200, 800, 200, 700, 100, 400, 100, fill='blue', outline='black') # Pino panel.create_polygon(1000, 500, 1300, 500, 1150, 200, fill='green', outline='black') # tronco panel.create_rectangle(1100, 500, 1200, 600, fill='brown', outline='black') panel.pack() elif select == 3: pack = Canvas(ventana, width=150, height=180, bg="steelblue") # Gorra de Mario pack.create_polygon(40, 10, 90, 10, 90, 20, 120, 20, 120, 30, 30, 30, 30, 20, 40, 20, width=2, fill="RED", outline="BLACK") # Cabeza de Mario pack.create_polygon(30, 30, 100, 30, 100, 40, 120, 40, 120, 50, 130, 50, 130, 60, 120, 60, 120, 70, 110, 70, 110, 80, 40, 80, 40, 70, 20, 70, 20, 40, 30, 40, width=2, fill="DARKORANGE", outline="BLACK") # Cuerpo de Mario pack.create_polygon(30, 80, 90, 80, 90, 90, 120, 90, 120, 100, 130, 100, 130, 110, 110, 110, 110, 120, 100, 120, 100, 130, 110, 130, 110, 150, 80, 150, 80, 140, 60, 140, 60, 150, 30, 150, 30, 130, 40, 130, 40, 120, 30, 120, 30, 110, 10, 110, 10, 100, 20, 100, 20, 90, 30, 90, width=2, fill="SaddleBROWN", outline="BLACK") # Ropa de Mario pack.create_polygon(50, 80, 60, 80, 60, 100, 80, 100, 80, 90, 90, 90, 90, 110, 100, 110, 100, 130, 110, 130, 110, 150, 80, 150, 80, 140, 60, 140, 60, 150, 30, 150, 30, 130, 40, 130, 40, 110, 50, 110, width=2, fill="RED", outline="BLACK") # Mano Izquierda de Mario pack.create_polygon(10, 110, 30, 110, 30, 120, 40, 120, 40, 130, 30, 130, 30, 140, 10, 140, width=2, fill="orange", outline="BLACK") # Mano Derecha de Mario pack.create_polygon(130, 110, 130, 140, 110, 140, 110, 130, 100, 130, 100, 120, 110, 120, 110, 110, width=2, fill="orange", outline="BLACK") # Bota Izquierda de Mario pack.create_polygon(50, 150, 50, 170, 10, 170, 10, 160, 20, 160, 20, 150, width=2, fill="saddlebrown", outline="BLACK") # Bota Derecha de Mario pack.create_polygon(100, 150, 100, 170, 140, 170, 140, 160, 130, 160, 130, 150, width=2, fill="saddlebrown", outline="BLACK") # Boton Izquierdo pack.create_rectangle(80, 110, 90, 120, width=2, fill="yellow", outline="BLACK") # Boton Derecho pack.create_rectangle(50, 110, 60, 120, width=2, fill="yellow", outline="BLACK") # Ojo y Bigote pack.create_polygon(80, 70, 120, 70, 120, 60, 100, 60, 100, 50, 90, 50, 90, 30, 80, 30, 80, 50, 90, 50, 90, 60, 80, 60, width=2, fill="saddlebrown", outline="black") # Cabello pack.create_polygon(30, 40, 20, 40, 20, 70, 40, 70, 40, 60, 30, 60, 30, 30, 60, 30, 60, 40, 50, 40, 50, 50, 60, 50, 60, 60, 40, 60, 40, 40, width=2, fill="saddlebrown", outline="black") pack.pack() def funcion2(): vent = Tk() vent.geometry("300x150") vent.configure(bg="black") vent.title("Poligonos") boton1 = Button(vent, text="Tren", bg="red", fg="blue", command=lambda: funcion(1, '')) boton1.pack(padx=5, pady=5, fill=X) boton2 = Button(vent, text="casita", bg="red", fg="blue", command=lambda: funcion(2, '')) boton2.pack(padx=5, pady=5, fill=X) boton3 = Button(vent, text="Mario bros", bg="red", fg="blue", command=lambda: funcion(3,'')) boton3.pack(padx=5, pady=5, fill=X) vent.mainloop() funcion2() |
lunes, 8 de octubre de 2018
Menu poligonos
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario