def funcion_main(): vp = Tk() vp.geometry("300x500+5+5") vp.configure(bg="gray") vp.title("Poligonos by Javier Munoz") boton1 = Button(vp, text="Ganso", bg="orange", fg="White", command=lambda: funcion(1, "Dibujo de un ganso por Javier Munoz")) boton1.pack(padx=5, pady=5, fill=X) vp.mainloop()
Este comentario ha sido eliminado por el autor.
ResponderEliminar#Codigo de un Ganso
ResponderEliminar#By: Francisco Javier Muñoz Rios
def funcion(seleccion, figura):
vs = Toplevel()
vs.configure(bg="gray")
vs.title(figura)
#Ganso
if seleccion == 1:
panel = Canvas(vs, width=600, height=500, bg="light blue")
panel.pack()
#Pie1
panel.create_polygon((70, 180),
(60, 170),
(90, 170),
width=1, fill="#FFFF00", outline="black")
#pie2
panel.create_polygon((100, 180),
(90, 170),
(120, 170),
fill="yellow", outline="black", width=1)
#pierna1
panel.create_line((90, 170),
(90, 160),
fill="black", width=1)
#pierna2
panel.create_line((120, 170),
(110, 160),
fill="black", width=1)
#cuerpo
panel.create_polygon((50, 50), (60, 40), (80, 40),
(90, 60), (90, 80), (70, 100),
(90, 100), (120, 120), (140,120),
(110,160), (90,160), (50,130),
(50, 100), (70, 80), (70, 60),
fill="gray", outline = "black", width=1)
# pico
panel.create_polygon((40, 60),
(70, 60),
(50, 50),
width=1, outline = "black", fill="yellow")
#ojo
panel.create_polygon((60,40), (60, 50), (70, 50), width = 1, outline = "black", fill = "yellow")
boton_ocultar = Button(vs, text = "Ocultar", bg = "Blue", fg = "white", command = vs.iconify)
boton_ocultar.pack()
def funcion_main():
vp = Tk()
vp.geometry("300x500+5+5")
vp.configure(bg="gray")
vp.title("Poligonos by Javier Munoz")
boton1 = Button(vp, text="Ganso", bg="orange", fg="White",
command=lambda: funcion(1, "Dibujo de un ganso por Javier Munoz"))
boton1.pack(padx=5, pady=5, fill=X)
vp.mainloop()
#By: Kenneth Marlon Barragan Lopez
ResponderEliminarfrom Tkinter import *
def funcion(seleccion, figura):
vs = Toplevel()
vs.configure(bg="gray")
vs.title(figura)
if seleccion == 1:
panel = Canvas(vs, width=640, height=180, bg="gray")
panel.pack()
# BODY
panel.create_polygon(50,10,70,10,70,30,90,30,90,50,150,50,150,30,170,30,190,30,190,10,
170,10,170,50,190,50,190,70,210,70,210,90,230,90,230,150,210,150,
210,110,190,110,190,150,170,150,130,150,130,170,170,170,170,130,
70,130,70,150,70,170,110,170,110,150,50,150,50,110,30,110,30,150,
10,150,10,90,30,90,30,70,50,70,50,50,70,50,70,30,50,30,50,10,
width=1, fill="green", outline="black")
# OJO
panel.create_polygon(70,70,90,70,90,110,70,110,70,70,
width=1, fill="white", outline="black")
# OJO
panel.create_polygon(150,70,170,70,170,110,150,110,150,70,
width=1, fill="white", outline="black")
#Nave
panel.create_polygon(340,160,340,140,320,140,320,120,260,120,260,100,300,100,300,80,320,
80,320,60,340,60,340,40,380,40,380,20,500,20,500,40,540,40,540,60,
560,60,560,80,580,80,580,100,620,100,620,120,560,120,560,140,540,140,
540,160,520,160,520,140,500,140,500,120,460,120,460,140,420,140,420,120,
380,120,380,140,360,140,360,160,340,160,
width=1, fill="orange", outline="black")
# NaveWindow
panel.create_polygon(340,80,340,100,360,100,360,80,340,80,
width=1, fill="white", outline="black")
panel.create_polygon(400,100,400,80,420,80,420,100,400,100,
width=1, fill="white", outline="black")
panel.create_polygon(460,100,460,80,480,80,480,100,460,100,
width=1, fill="white", outline="black")
panel.create_polygon(520,100,520,80,540,80,540,100,520,100,
width=1, fill="white", outline="black")
vp = Tk()
vp.geometry("300x40+5+5")
vp.configure(bg="black")
vp.title("Poligonos")
boton1 = Button(vp, text="ALIEN", bg="blue", fg="White",command=lambda: funcion(1, "Programa por KENNETH BARRAGAN"))
boton1.pack(padx=5, pady=5, fill=X)
vp.mainloop()
from Tkinter import *
ResponderEliminarv0= Tk()
v0.title("ventana principal")
v0.config(bg="blue")
v0.geometry("500x500")
v0.iconbitmap("nike.ico")
def mostrar(num):
v1= Toplevel(v0)
v1.title("Ventana hija")
v1.protocol("wn_DELETE_WINDOW", "onexit")
v1.geometry("600x600")
if num == 1:
canvas1=Canvas(v1, width=200,height=200,bg="black")
canvas1.pack(expand=YES, fill=BOTH)
canvas1.create_polygon(140, 20, 160, 20, 200, 40, 240, 80, 260, 100, 300, 80, 340, 100, 360, 80, 400, 40, 440, 20, 460, 20, 480, 80, 460, 140, 440, 200, 360, 140, 300, 200, 240, 140, 160, 200, 140, 140, 120, 80, width=5, fill=("#C6A58A"), outline="#FFFFFF")
canvas1.create_polygon(160, 200, 240, 140, 300, 200, 360, 140, 440, 200, 460, 280, 480, 360, 460, 360, 440, 340, 380, 400, 320, 420, 280, 420, 220, 400, 160, 340, 140, 360, 120, 360, 140, 300, width=5, fill=("#AF7A4E"), outline="#FFFFFF")
canvas1.create_polygon(200, 220, 220, 220, 260, 240, 220, 240, width=5, fill=("yellow"), outline="#000000")
canvas1.create_polygon(340, 240, 380, 220, 400, 220, 380, 240, width=5, fill=("yellow"), outline="#000000")
canvas1.create_polygon(320, 220, 340, 300, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(340, 300, 360, 340, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(360, 340, 360, 360, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(280, 220, 260, 300, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(260, 300, 240, 340, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(240, 340, 240, 360, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(240, 360, 280, 380, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(360, 360, 320, 380, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(360, 360, 400, 280, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(240, 360, 200, 280, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(320, 380, 340, 340, 320, 320, 280, 320, 260, 340, 280, 380, width=5, fill=("black"), outline="#FFFFFF")
canvas1.create_polygon(220, 220, 240, 240, 220, 240, width=5, fill=("black"), outline="#000000")
canvas1.create_polygon(380, 220, 380, 240, 360, 240, width=5, fill=("black"), outline="#000000")
canvas1.create_polygon(160, 40, 160, 140, 180, 160, 220, 120, 220, 100, width=5, fill=("#AF7A4E"), outline="#FFFFFF")
canvas1.create_polygon(440, 40, 380, 100, 380, 120, 420, 160, 440, 140, width=5, fill=("#AF7A4E"), outline="#FFFFFF")
def ocultar(ventana):ventana.destroy()
def ejecutar(f):v0.after(200,f)
b1=Button(v0,text="Abrir ventanea con linea", command=lambda:ejecutar(mostrar(1)))
b1.grid(row=1,column=1)
v0.mainloop()
from Tkinter import *
ResponderEliminardef poligono (ventana):
panel=Canvas(width=1000, height=600, bg="cyan")
panel.pack()
#cuerpo
panel.create_polygon(96, 110, 137, 110, 290, 110,317, 137, 289, 164, 275, 179, 275, 317, 220, 303, 221, 276, 206, 261, 165, 275, 151, 276, 109, 247, 109, 234, 123, 220, 165, 220, 165, 179, 96, 165, width=1, fill="#6BE0FF", outline="black")
#mano
panel.create_polygon(289, 109, 303, 82, 325, 60, 337, 62, 344, 82, 344, 55, 330, 55, 330, 42, 345, 27, 372, 28, 385, 41, 385, 69, 317, 137, width=1, fill="#2063FF", outline="black")
#buster
panel.create_polygon(96, 165, 96, 178, 54, 178, 41, 164, 13, 165, 14, 151, 0, 137, 13, 124, 13, 110, 41, 109, 55, 96, 96, 96, 96, 109 , width=1, fill="#2063FF", outline="black")
#pies
panel.create_polygon(165, 275, 152, 316, 137, 331, 82, 331, 68, 317, 68, 303, 96, 276, 109, 234, 123, 220, width=1, fill="#2063FF", outline="black")
panel.create_polygon(275, 303, 275, 330, 261, 344, 261, 399, 246, 413, 220, 412, 206, 399, 206, 330, 220, 316, 220, 289, width=1, fill="#2063FF", outline="black")
# cabeza
panel.create_polygon(138, 137, 138, 68, 275, 68, 275, 137, 234, 179, 179, 178, width=1, fill="#FFF595", outline="black")
# cara
panel.create_polygon(151, 137, 179, 137, 179, 82, 138, 82, 138, 110, width=1, fill="#FFFFFF", outline="black")
panel.create_polygon(165, 124, 179, 124, 179, 96, 165, 96, width=1, fill="#000000", outline="black")
panel.create_polygon(193, 137, 193, 82, 234, 82, 248, 96, 248, 124, 234, 138, width=1, fill="#FFFFFF", outline="black")
panel.create_polygon(193, 124, 220, 124, 220, 96, 193, 96, width=1, fill="#000000", outline="black")
panel.create_polygon(179, 137, 207, 138, 220, 151, 220, 164, 207, 179, 179, 178, 165, 165, 165, 151, width=1, fill="#000000", outline="black")
#armor
panel.create_polygon(247, 137, 247, 165, 275, 137, 275, 55, 249, 28, 220, 28, 193, 55, 193, 69, 165, 69, 165, 55, 151, 55, 137, 69, 137, 82, 165, 82, 165, 96, 193, 96, 193, 83, 234, 82, 261, 108, 261, 137, width=1, fill="#2063FF", outline="black")
panel.create_polygon(275, 220, 275, 248, 235, 261, 207, 261, 165, 220, width=1, fill="#2063FF", outline="black")
#accesorios
panel.create_polygon(0, 137, 13, 124, 82, 124, 70, 137, width=1, fill="#6BE0FF", outline="black")
panel.create_polygon(165, 68, 165, 55, 193, 27, 220, 27, 193, 55, 193, 68, width=1, fill="#6BE0FF", outline="black")
ventana=Tk()
ventana.title("Poligonos")
ventana.config(bg="blue")
ventana.geometry("700x700")
boton= Button(ventana,text="Crear Poligono", command=lambda: poligono(ventana))
boton.pack()
ventana.mainloop()
https://gist.github.com/VHugoBarnes/a9877842e4b9ab6d826dc27a379f4b9b
ResponderEliminarfrom Tkinter import*
ResponderEliminarv0=Tk()
v0.title('Ventana principal')
v0.config(bg='green')
v0.geometry("500x500")
def mostrar(num):
v1=Toplevel(v0)
v1.title('Ventana hija')
v1.protocol('wn_DELETE_WINDOW',"onexit")
v1.geometry("700x630")
if num == 1:
canvas1=Canvas(v1,width=800,height=800,bg="#092A81")
canvas1.pack(expand=YES,fill=BOTH)
#casco
canvas1.create_polygon(66, 145,75,110, 105, 70, 132,42,165,32,240,31,300,83,325,157,294,210,
211, 265, 169, 268, 128, 254, 80, 205, width=10, fill='grey',outline="black")
#VidrioCasco
canvas1.create_polygon(66,145,75,110,105,70,160,47,224,48,256,64,290,98,308,137,309,163,283,178,256,211,
211,265,169,268,128,254,80,205,width=10, fill="black")
#Cuerpo
canvas1.create_polygon( 294, 210, 211, 265, 169, 268 ,165,275 ,175,320, 220,375,310,420, 410,430, 430,440, 485,419, 510,445,
530,430,528,380,470,380,410,340,315,215,width=10, fill='#FFA107',outline="black")
#LineaPiernas
canvas1.create_polygon( 410,430, 330,380,width=10, fill='black',outline="black")
# Mochila1
canvas1.create_polygon(315,215 ,410,340 ,470,295, 435,210 ,380,180,360,180, width=10, fill='#DC5700',outline="black")
# Mochila2
canvas1.create_polygon(315, 215, 360,180,285,50,270,58,300,83,325,157,294,210, width=10, fill='#CA5101',outline="black")
#Luna
#luna
canvas1.create_oval(-50, 800, 800, 460, width=10, fill='grey')
#Brazo
canvas1.create_polygon(165,275,155,318,115,340,109,350,118,370,135,380,160,370,193,350,175,320 ,width=10, fill='black')
#Palo de bandera
canvas1.create_polygon(30,220,240,500,width=10, fill='blue', outline="black")
canvas1.create_polygon(370,235,360,100,width=10, fill='blue', outline="white")
canvas1.create_polygon(360, 100, width=10, fill='blue', outline="black")
#bandera
canvas1.create_polygon(30, 220, 0,240,0,400, 105,320,width=10, fill='white',outline="black")
#brazo2
canvas1.create_polygon(270,250,285,245,300,250,310,270,280,360,220,400,202,395,198,368,238,338 ,width=10, fill='black', outline="black")
#bota
canvas1.create_polygon( 505,380,485,419, 510,445,
530,430,520,380,width=10, fill='black', outline="black")
#Reflejo
canvas1.create_polygon( 220,75,210,90,200,95,220,110,245,115,245,95,width=10, fill='white')
def ejecutar(f):v0.after(200,f)
b1=Button(v0,text='Astronauta',command=lambda:ejecutar(mostrar(1)))
b1.grid(row=1,column=1)
v0.mainloop()
Figura de un perrito.
ResponderEliminarhttps://gist.github.com/twor3dg/490283390a72b83a4ed0c99bade3f217
Borrar linea 10 (icono)
Eliminarhttps://itmgraf.wordpress.com/2019/10/14/poligonos-en-tkinter/
ResponderEliminarFigura de Marshmello
ResponderEliminarhttps://gist.github.com/brandon22esquivel/46fde424c31cd7153a5d7db1d17ff7cc
Figura Mickey Mouse
ResponderEliminarhttps://cynthializethbarron.blogspot.com/2019/10/mickey-mouse-con-tkinter.html
https://gist.github.com/nicole1014/791278eabf31541c53adf656aa9b3d14
ResponderEliminarhttps://gist.github.com/nicole1014/791278eabf31541c53adf656aa9b3d14
ResponderEliminarhttps://cuaj990804.blogspot.com/2019/10/figura-naruto-pixel-art.html
ResponderEliminarhttps://alfredodejesussantosgutierrez.blogspot.com/2019/10/mi-figura-con-tkinter-y-seleccion-de.html
ResponderEliminarhttps://luismolina30.blogspot.com/2019/10/creacion-de-figura-en-pythongato.html
ResponderEliminarhttps://graficacionbandasblog.blogspot.com/2019/10/figura-steve-tkinter.html
ResponderEliminarBatman
ResponderEliminarhttps://gist.github.com/Alberto241013/6d9876b098925f77ccb25226010e8f91
Figura de gatito pusheen
ResponderEliminarhttps://cynthiamaldonadoramirez.blogspot.com/2019/10/trazado-de-figuras-en-tkinter.html
ResponderEliminarfrom Tkinter import *
v0=Tk()
v0.title('ventana principal')
v0.config(bg="deepskyblue")
v0.geometry("300x300")
def mostrar(num):
v1= Toplevel(v0)
v1.title('ventana hija')
v1.protocol('wn_DELETE_WINDOW',"onexit")
v1.geometry('800x800')
if num == 1:
canvas1 = Canvas(v1, width=200, height=200, bg='darkcyan')
canvas1.pack(expand=YES, fill=BOTH)
canvas1.create_polygon(100,450, 100,600, 200,700, 650,700, 750,600, 750,500, 450,500, 450,100, 400,100, 400,500, 300,500, 300,450, 100,450, fill='sienna',outline="black")
canvas1.create_polygon(350,450, 150,350, 350,150, 350,450, fill="peachpuff", outline="black")
canvas1.create_polygon(475,450, 475,150, 750,450, 475,450, fill="peachpuff", outline="black")
canvas1.create_polygon(250,600, 250,550, 300,550, 300,600, 250,600, fill="light blue", outline="black")
canvas1.create_polygon(400,600, 400,550, 450,550, 450,600, 400,600, fill="light blue", outline="black")
canvas1.create_polygon(550,600, 550,550, 600,550, 600,600, 550,600, fill = "light blue", outline = "black")
def ocultar(ventana): ventana.destroy()
def ejecutar(f): v0.after(200, f)
b1=Button(v0,text='BARQUITO',command=lambda:ejecutar(mostrar(1)))
b1.grid(row=1,column=1)
v0.mainloop()