lunes, 11 de noviembre de 2019

Comprobacion con uso de clases.



usuarioc

class usuario_validar():
    errors = []

    def longitud(self, usercomp):
        if len(usercomp) < 6:
            self.errors.append('El nombre de usuario debe contener al menos 6 caracteres')
            return False

        elif len(usercomp) > 12:
            self.errors.append('El nombre de usuario debe contener maximo 12 caracteres')
            return False

        else:
            return True

    def alfanumerico(self, usercomp):
        if usercomp.isalnum() == False:
            self.errors.append('El nombre de usuario puede contener solo letras y numeros')
            return False
        else:
            return True

    def validar_usuario(self, usercomp):
        valido = self.longitud(usercomp) and self.alfanumerico(usercomp)
        return valido



paswordc


class password_validar():

    errors=[]

    def longitud(self, passw):
        if len(passw) < 8:
            self.errors.append('La contrasena debe tener al menos 8 caracteres')
            return False
        else:
            return True

    def minuscula(self, passw):
        letras_minuscula=False
        for carac in passw:
            if carac.islower()==True:
                letras_minuscula=True
        if not letras_minuscula:
            self.errors.append('La contrasena debe tener al menos una minuscula')
            return False
        else:
            return True

    def mayuscula(self, passw):
        letras_mayuscula=False
        for carac in passw:
            if carac.isupper()==True:
                letras_mayuscula=True
        if not letras_mayuscula:
            self.errors.append('La contrasena debe tener al menos una mayuscula')
            return False
        else:
            return True

    def numero(self, passw):
        num=False
        for carac in passw:
            if carac.isdigit()== True:
                num=True

        if not num:
            self.errors.append('La contrasena debe tener al menos un numero')
            return False
        else:
            return True

    def no_alfanumerico(self, passw):
        if passw.isalnum()==True:
            self.errors.append('La contrasena debe tener al menos un caracter no alfanumerico')
            return False
        else:
            return True

    def espacios(self, passw):
        if passw.count(" ")> 0:
            self.errors.append('La contrasena no puede contener espacios en blanco')
            return False
        else:
            return True

    def validar_password(self,passw):
        valido=self.longitud(passw) and self.minuscula(passw) and self.mayuscula(passw) and self.numero(passw) and self.no_alfanumerico(passw) and self.espacios(passw)
        return valido



validadorc


# -*- coding: utf-8 -*-
from Tkinter import *
import tkMessageBox
import usuarioc  as uv
import paswordc as pv

user_validator = uv.usuario_validar()
pass_validator = pv.password_validar()

def validation():
    cuser = user.get()
    cpasword = pasword.get()
    correcto = False


    if correcto == False:
        if not user_validator.validar_usuario(cuser):
            for error in user_validator.errors:
                tkMessageBox.showinfo("Aviso error usuario",error)
                correcto = False

                user_validator.errors.remove(error)
        else:
            correcto = True
            if correcto == True:
                if not pass_validator.validar_password(cpasword):
                    for error in pass_validator.errors:
                        tkMessageBox.showinfo("Aviso error contraseña",error)
                        correcto = True
                        pass_validator.errors.remove(error)
                else:
                    correcto = False
                    tkMessageBox.showinfo("Aviso", "Usuario y contraseña creados exitosamente")

raiz=Tk()
raiz.title("ventana primaria")
raiz.resizable(1,1) #para permitir agrandar o no el ancho o la altura con el moyuse
raiz.iconbitmap("descarga.ico")
#raiz.geometry("500x600")
raiz.config(bg="cyan")
raiz.config(bd=15)
raiz.config(relief="groove")

miFrame=Frame(raiz)
miFrame.pack()
miFrame.config(bg="pink")
miFrame.config(bd=10)
miFrame.config(relief="sunken")
miFrame.config(cursor="hand2")

miLabel1=Label(miFrame, text="Ingrese sus datos", fg="red",bg="pink",font=("Arial",18)).grid(row=0,column=0,pady="4")
nombreusuarioLabel=Label(miFrame, text="Nombre usuario: ",bg="pink").grid(row=3,column=0, sticky="w",pady="1")
contrasenaLabel=Label(miFrame, text="Contraseña: ",bg="pink").grid(row=4,column=0,sticky="w",pady="1")

user=StringVar()
pasword=StringVar()


cuadronombreusuario=Entry(miFrame, textvariable=user)
cuadronombreusuario.grid(row=3,column=1,pady="1")
cuadronombreusuario.config(fg="blue", justify="center")

cuadrocontrasena=Entry(miFrame, textvariable=pasword)
cuadrocontrasena.grid(row=4,column=1,pady="1")
cuadrocontrasena.config(show="*",fg="blue", justify="center")

botonEnvio=Button(raiz, text= "Enviar",command=validation)
botonEnvio.pack()


raiz.mainloop()

Interfaz:


Errores al ingresar los datos:






Datos ingresados de manera correcta:

Comprobacion del password y del usuario con metodos en TKinter.

# -*- coding: utf-8 -*-
from Tkinter import *
import tkMessageBox

def usercomp():
    cuser=user.get()
    longitud=len(cuser)
    notnum=cuser.isalnum()
    if notnum == False:
        tkMessageBox.showinfo("Error", "El nombre de usuario puede contener solo letras y números")
    elif longitud < 6:
        tkMessageBox.showinfo("Error","El nombre de usuario debe contener al menos 6 caracteres")
    elif longitud > 12:
        tkMessageBox.showinfo("Error", "El nombre de usuario no puede contener más de 12 caracteres")
    elif longitud > 5 and longitud < 13 and notnum == True:
        return True

def clavecomp():
    cpasword=pasword.get()
    validar = False  # que se vayan cumpliendo los requisitos uno a uno.
    long = len(cpasword)  # Calcula la longitud de la contraseña
    espacio = False  # variable para identificar espacios
    mayuscula = False  # variable para identificar letras mayúsculas
    minuscula = False  # variable para contar identificar letras minúsculas
    numeros = False  # variable para identificar números
    y = cpasword.isalnum()  # si es alfanumérica retona True
    correcto = True  # verifica que hayan mayuscula, minuscula, numeros y no alfanuméricos

    for carac in cpasword:  # ciclo for que recorre caracter por caracter en la contraseña

        if carac.isspace() == True:  # Saber si el caracter es un espacio
            espacio = True  # si encuentra un espacio se cambia el valor user

        if carac.isupper() == True:  # saber si hay mayuscula
            mayuscula = True  # acumulador o contador de mayusculas

        if carac.islower() == True:  # saber si hay minúsculas
            minuscula = True  # acumulador o contador de minúsculas

        if carac.isdigit() == True:  # saber si hay números
            numeros = True  # acumulador o contador de numeros

    if espacio == True:  # hay espacios en blanco
        tkMessageBox.showinfo("Error en la contraseña", "La contraseña no puede contener espacios")
    else:
        validar = True  # se cumple el primer requisito que no hayan espacios

    if long < 8 and validar == True:
        tkMessageBox.showinfo("Error en la contraseña ","Mínimo 8 caracteres")
        validar = False  # cambia a Flase si no se cumple el requisito móinimo de caracteres

    if mayuscula == True and minuscula == True and numeros == True and y == False and validar == True:
        validar = True  # Cumple el requisito de tener mayuscula, minuscula, numeros y no alfanuméricos
    else:
        correcto = False  # uno o mas requisitos de mayuscula, minuscula, numeros y no alfanuméricos no se cumple

    if validar == True and correcto == False:
        tkMessageBox.showinfo("Aviso",
            "La contraseña elegida no es segura: debe contener letras minúsculas, mayúsculas, números y al menos 1 carácter no alfanumérico")

    if validar == True and correcto == True:
        return True

def validation():
    correcto = False
    if correcto == False:

        if usercomp() == True:

            correcto = True

            if correcto == True:
                if clavecomp() == True:
                    tkMessageBox.showinfo("Aviso", "Usuario y contraseña creados exitosamente")
                    correcto = False

raiz=Tk()
raiz.title("ventana primaria")
raiz.resizable(1,1) #para permitir agrandar o no el ancho o la altura con el moyuse
raiz.iconbitmap("descarga.ico")
#raiz.geometry("500x600")
raiz.config(bg="cyan")
raiz.config(bd=15)
raiz.config(relief="groove")

miFrame=Frame(raiz)
miFrame.pack()
miFrame.config(bg="pink")
miFrame.config(bd=10)
miFrame.config(relief="sunken")
miFrame.config(cursor="hand2")

miLabel1=Label(miFrame, text="Ingrese sus datos", fg="red",bg="pink",font=("Arial",18)).grid(row=0,column=0,pady="4")
nombreusuarioLabel=Label(miFrame, text="Nombre usuario: ",bg="pink").grid(row=3,column=0, sticky="w",pady="1")
contrasenaLabel=Label(miFrame, text="Contraseña: ",bg="pink").grid(row=4,column=0,sticky="w",pady="1")

user=StringVar()
pasword=StringVar()


cuadronombreusuario=Entry(miFrame, textvariable=user)
cuadronombreusuario.grid(row=3,column=1,pady="1")
cuadronombreusuario.config(fg="blue", justify="center")

cuadrocontrasena=Entry(miFrame, textvariable=pasword)
cuadrocontrasena.grid(row=4,column=1,pady="1")
cuadrocontrasena.config(show="*",fg="blue", justify="center")

botonEnvio=Button(raiz, text= "Enviar",command=validation)
botonEnvio.pack()


raiz.mainloop()

Interfaz:


Errores:


Datos ingresados correctamente:

Interfaz con TKinter #2

# -*- coding: utf-8 -*-
from Tkinter import *
import Tkinter as tk

raiz=Tk()
raiz.title("ventana primaria")
raiz.resizable(1,1) #para permitir agrandar o no el ancho o la altura con el moyuse
raiz.iconbitmap("Hamburger.ico")
#raiz.geometry("500x600")
raiz.config(bg="orange")
raiz.config(bd=15)
raiz.config(relief="groove")

miFrame=Frame(raiz)
miFrame.pack()
miFrame.config(bg="yellow")
miFrame.config(bd=10)
miFrame.config(relief="sunken")
miFrame.config(cursor="hand2")
#Etiquetas
miLabel1=Label(miFrame, text="Hamburguesa feliz", fg="red",bg="yellow",font=("Arial Black",25)).grid(row=0,column=0,pady="4")
OrdenH=Label(miFrame, text="Seleccione la hamburguesa", bg="yellow",font=("Arial",14)).grid(row=1,column=0,pady="1",padx="15", sticky="w")
Pedido=Label(miFrame, text="Pedido:", bg="yellow",font=("Arial",14)).grid(row=1,column=2,pady="1")
cantidadhamb=Label(miFrame, text="Cantidad de Hamburguesas:", bg="yellow",font=("Arial",14)).grid(row=2,column=0,pady="1",padx="15", sticky="w")
complementos=Label(miFrame, text="Complementos:", bg="yellow",font=("Arial",14)).grid(row=3,column=0,pady="1",padx="15", sticky="w")
Cantidadcomp=Label(miFrame, text="Cantidad complementos:", bg="yellow",font=("Arial",14)).grid(row=3,column=1,pady="1",padx="15", sticky="w")
Formadepago=Label(miFrame, text="Forma de pago:", bg="yellow",font=("Arial",14)).grid(row=7,column=0,pady="1",padx="15", sticky="w")
Total=Label(miFrame, text="Total:", bg="yellow",font=("Arial",14)).grid(row=7,column=1,pady="1",padx="15", sticky="w")
rtotal=Label(miFrame, text="_", bg="yellow",font=("Arial",14)).grid(row=7,column=2,pady="1",padx="15", sticky="w")
IVA=Label(miFrame, text="IVA:", bg="yellow",font=("Arial",14)).grid(row=8,column=1,pady="1",padx="15", sticky="w")
riva=Label(miFrame, text="_", bg="yellow",font=("Arial",14)).grid(row=8,column=2,pady="1",padx="15", sticky="w")
TotalFinal=Label(miFrame, text="Total final:", bg="yellow",font=("Arial",14)).grid(row=9,column=1,pady="1",padx="15", sticky="w")
rtotalfinal=Label(miFrame, text="_", bg="yellow",font=("Arial",14)).grid(row=9,column=2,pady="1",padx="15", sticky="w")


#Lista de opciones despegable
var1=tk.StringVar(miFrame)
var1.set("No ha selecionado")
opciones=["Hamburguesa sencilla","Hamburguesa Doble","Hamburguesa triple"]
opcion=tk.OptionMenu(miFrame,var1,*opciones)
opcion.config(width=20)
opcion.grid(row=1,column=1)

#Listbox
listpedido=Listbox(miFrame, width=50).grid(row=2,column=2,pady="1",padx="4")

#Entrys
cuadrohamb=Entry(miFrame )
cuadrohamb.grid(row=2,column=1,pady="1")
cuadrohamb.config(fg="blue", justify="center")
cuadrorefresco=Entry(miFrame )
cuadrorefresco.grid(row=4,column=1,pady="1")
cuadrorefresco.config(fg="blue", justify="center")
cuadropapas=Entry(miFrame )
cuadropapas.grid(row=5,column=1,pady="1")
cuadropapas.config(fg="blue", justify="center")
cuadroburrito=Entry(miFrame )
cuadroburrito.grid(row=6,column=1,pady="1")
cuadroburrito.config(fg="blue", justify="center")


#Checkbutton
CheckVar1=IntVar()
CheckVar2=IntVar()
CheckVar3=IntVar()
Refresco=Checkbutton(miFrame,text="Refresco",bg="yellow", variable=CheckVar1)
Refresco.grid(row=4,column=0, sticky="w",padx="15")
Refresco.config(onvalue=1, offvalue=0)
Papas=Checkbutton(miFrame,text="Papas", bg="yellow",variable=CheckVar2)
Papas.grid(row=5,column=0, sticky="w",padx="15")
Papas.config(onvalue=1, offvalue=0)
Burrito=Checkbutton(miFrame,text="Burrito",bg="yellow", variable=CheckVar3)
Burrito.grid(row=6,column=0, sticky="w",padx="15")
Burrito.config(onvalue=1, offvalue=0)

#Radiobutton
var = IntVar()
R1 = Radiobutton(miFrame, text="Tarjeta de credito",bg="yellow", variable=var, value=1)#, command=sel)
R1.grid(row=8,column=0, sticky="w",padx="15")
R2 = Radiobutton(miFrame, text="Efectivo",bg="yellow", variable=var, value=2) #, command=sel)
R2.grid(row=9,column=0, sticky="w",padx="15")



#botones
Cancelar=Button(miFrame, text= "Cancelar")
Cancelar.grid(row=10,column=0, sticky="w",padx="15")
Comprar=Button(miFrame, text= "Hacer pedido")
Comprar.grid(row=10,column=2, sticky="e",padx="15")
Terminar=Button(raiz, text= "Terminar")
Terminar.pack()

raiz.mainloop()

Mi figura con TKinter.

Para trabajar en figuras con tkinter es como si trabajaremos en el 4to cuadrante de un plano cartesiano, nada mas que la Y en lugar de ser negativa sera positiva, y al igual que en el plano cartesiano tomamos primero Y y después Y.


Esta sera mi figura:


from tkinter import *


def main():
    ventana = Tk()
    ventana.title("Pikachu")
    lienzo = Canvas(ventana, bg="white",height=300,width=280)
    lienzo.grid(row=0,column=0)
    lienzo2 = Canvas(ventana, bg="white",height=300,width=280)
    lienzo2.grid(row=0,column=1)
    lienzo3 = Canvas(ventana, bg="white",height=300,width=280)
    lienzo3.grid(row=1,column=0)
    lienzo4 = Canvas(ventana, bg="white",height=300,width=280)
    lienzo4.grid(row=1,column=1)
    dibujarPikachu(lienzo)
    dibujarPikachu(lienzo2)
    dibujarPikachu(lienzo3)
    dibujarPikachu(lienzo4)
def dibujarPikachu(lienzo):
    #base
    lienzo.create_polygon((0,0),(0,40),(10,40),(10,60),(20,60),(20,80),(30,80),(30,90),(40,90),(40,100),(50,100),(50,120),(40,120),(40,160),(30,160),(30,190),(40,190),(40,200),(50,200),(50,210),(60,210),(60,220),(80,220),(80,230),(110,230),(110,240),(170,240),(170,230),(200,230),(200,220),(220,220),(220,210),(230,210),(230,200),(240,200),(240,190),(250,190),(250,160),(240,160),(240,120),(230,120),(230,100),(240,100),(240,90),(250,90),(250,80),(260,80),(260,60),(270,60),(270,40),(280,40),(280,0),(260,0),(260,10),(240,10),(240,20),(230,20),(230,30),(210,30),(210,40),(200,40),(200,50),(180,50),(180,60),(160,60),(160,50),(120,50),(120,60),(100,60),(100,50),(80,50),(80,40),(70,40),(70,30),(50,30),(50,20),(40,20),(40,10),(30,10),(20,10),(20,0),(0,0),fill="black")
    #cuerpo
    lienzo.create_polygon((30,30),(30,80),(40,80),(40,90),(50,90),(50,100),(60,100),(60,90),(70,90),(70,100),(60,100),(60,120),(50,120),(50,160),(40,160),(40,190),(50,190),(50,200),(60,200),(60,210),(80,210),(80,220),(110,220),(110,230),(170,230),(170,220),(200,220),(200,210),(220,210),(220,200),(230,200),(230,190),(240,190),(240,160),(230,160),(230,120),(220,120),(220,100),(210,100),(210,90),(220,90),(220,100),(230,100),(230,90),(240,90),(240,80),(250,80),(250,30),(230,30),(230,40),(210,40),(210,50),(200,50),(200,60),(180,60),(180,70),(160,70),(160,60),(120,60),(120,70),(100,70),(100,60),(80,60),(80,50),(70,50),(70,40),(50,40),(50,30),(30,30),fill="yellow")
    #ojo1
    lienzo.create_polygon((70,130),(80,130),(80,120),(100,120),(100,130),(110,130),(110,150),(100,150),(100,160),(80,160),(80,150),(70,150),(70,130),fill="black")
    #brillo1
    lienzo.create_polygon((80,130),(80,140),(90,140),(90,130),(80,130),fill="white")
    #ojo2
    lienzo.create_polygon((170,130),(180,130),(180,120),(200,120),(200,130),(210,130),(210,150),(200,150),(200,160),(180,160),(180,150),(170,150),(170,130),fill="black")
    #brillo2
    lienzo.create_polygon((190,130),(190,140),(200,140),(200,130),(190,130),fill="white")
    #nariz
    lienzo.create_polygon((130,150),(150,150),(150,160),(130,160),(130,150),fill="black")
    #chapita1
    lienzo.create_polygon((60,160),(80,160),(80,170),(90,170),(90,190),(80,190),(80,200),(60,200),(60,190),(50,190),(50,170),(60,170),(60,160),fill="red")
    #chapita2
    lienzo.create_polygon((200,160),(220,160),(220,170),(230,170),(230,190),(220,190),(220,200),(200,200),(200,190),(190,190),(190,170),(200,170),(200,160),fill="red")
    #boquita
    lienzo.create_polygon((110,170),(120,170),(120,180),(130,180),(130,170),(150,170),(150,180),(160,180),(160,170),(170,170),(170,180),(160,180),(160,210),(150,210),(150,220),(130,220),(130,210),(120,210),(120,180),(110,180),(110,170),fill="black")
    #lengua
    lienzo.create_polygon((130,190),(150,190),(150,210),(130,210),(130,190),fill="red")


main()


Boton de ocultar.

from Tkinter import *

def funcion(seleccion, figura):
    vs = Toplevel()
    vs.configure(bg="gray")
    vs.title(figura)
    if seleccion == 1:
        panel = Canvas(vs, width=1200, height=650, bg="gray")
        panel.pack()
        # cara
        panel.create_polygon(415, 50, 235, 490, 365, 625, 755, 625, 850, 500, 700, 50,
                             width=1, fill="#e0af77", outline="brown")
        # orejas
        panel.create_polygon(415, 50, 60, 320, 175, 635, width=1, fill="#bb6400", outline="#000000")
        panel.create_polygon(700, 50, 1045, 320, 896, 635, width=1, fill="#bb6400", outline="#000000")
        # menton
        panel.create_polygon(365, 625, 550, 415, 755, 625, width=1, fill="#bb6400", outline="#000000")
        # ojos
        panel.create_oval(420, 225, 480, 305, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(630, 225, 690, 305, width=1, fill="#1a1200", outline="#000000")
        # bigotes
        panel.create_oval(475, 525, 490, 540, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(615, 525, 630, 540, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(445, 560, 460, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(610, 560, 625, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(480, 560, 495, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(640, 560, 655, 575, width=1, fill="#1a1200", outline="#000000")
        # nariz
        panel.create_oval(470, 305, 640, 500, width=1, fill="#1a1200", outline="#000000")
        boton1 = Button(vs, text="Cerrar", bg="Red", command=lambda: ocultar(vs))
        boton1.pack()

def ocultar(ventana): ventana.withdraw()


vp = Tk()
vp.geometry("300x200")
vp.configure(bg="black")
vp.title("Poligonos grupo A")

boton1 = Button(vp, text="Perrito", bg="blue", fg="White", command=lambda: funcion(1, "Programa por Ambrocio Laureano"))
boton1.pack(padx=5, pady=5, fill=X)



vp.mainloop()


Ejemplos de figuras.

from Tkinter import *

def funcion(seleccion, figura):
    vs = Toplevel()
    vs.configure(bg="gray")
    vs.title(figura)
    if seleccion == 1:
        panel = Canvas(vs, width=1200, height=650, bg="gray")
        panel.pack()
        # cara
        panel.create_polygon(415, 50, 235, 490, 365, 625, 755, 625, 850, 500, 700, 50,
                             width=1, fill="#e0af77", outline="brown")
        # orejas
        panel.create_polygon(415, 50, 60, 320, 175, 635, width=1, fill="#bb6400", outline="#000000")
        panel.create_polygon(700, 50, 1045, 320, 896, 635, width=1, fill="#bb6400", outline="#000000")
        # menton
        panel.create_polygon(365, 625, 550, 415, 755, 625, width=1, fill="#bb6400", outline="#000000")
        # ojos
        panel.create_oval(420, 225, 480, 305, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(630, 225, 690, 305, width=1, fill="#1a1200", outline="#000000")
        # bigotes
        panel.create_oval(475, 525, 490, 540, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(615, 525, 630, 540, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(445, 560, 460, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(610, 560, 625, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(480, 560, 495, 575, width=1, fill="#1a1200", outline="#000000")
        panel.create_oval(640, 560, 655, 575, width=1, fill="#1a1200", outline="#000000")
        # nariz
        panel.create_oval(470, 305, 640, 500, width=1, fill="#1a1200", outline="#000000")
    elif seleccion == 2:
        panel = Canvas(vs, width=500, height=450, bg="gray")
        panel.pack()
        # cara
        panel.create_polygon(200, 80, 120, 240, 120, 260, 140, 300, 160, 310, 240, 310, 310, 290, 350, 280, 360, 250,
                             350, 230,
                             340, 210, 250, 80,
                             width=1, fill="yellow", outline="black")
        # cejas
        panel.create_polygon(150, 190, 142, 200, 175, 225, 185, 210, width=1, fill="black", outline="black")
        panel.create_polygon(200, 210, 210, 220, 248, 205, 240, 190, width=1, fill="black", outline="black")
        # boca
        panel.create_polygon(150, 250, 150, 260, 185, 255, 170, 263,
                             173, 275, 205, 263, 200, 240, width=2, fill="orange", outline="black")
        # ojos
        panel.create_oval(210, 215, 255, 235, width=1, fill="white", outline="black")
        panel.create_oval(140, 218, 175, 235, width=1, fill="white", outline="black")
        # pupilas
        panel.create_oval(215, 215, 235, 235, width=1, fill="black", outline="black")
        panel.create_oval(140, 218, 160, 235, width=1, fill="black", outline="black")
        # cabello
        panel.create_polygon(200, 80, 210, 75, 210, 60, 220, 50, 220, 70, 230, 50, 240, 50,
                             240, 60, 230, 70, 255, 65, 260, 70, 240, 78,
                             260, 80, 230, 88, width=1, fill="black", outline="black")
    elif seleccion == 3:
        panel = Canvas(vs, width=500, height=450, bg="skyblue")
        panel.pack()
        # cara
        panel.create_oval(120, 80, 320, 200, width=2, fill="chocolate", outline="black")

        # ojos
        panel.create_oval(180, 100, 200, 130, width=1, fill="black", outline="black")
        panel.create_oval(240, 100, 260, 130, width=1, fill="black", outline="black")

        # pupila
        panel.create_oval(185, 105, 190, 115, width=1, fill="white", outline="black")
        panel.create_oval(245, 105, 250, 115, width=1, fill="white", outline="black")

        # boca
        panel.create_arc(170, 140, 270, 180, extent=180, style=CHORD, start=180, width=2, fill="black", outline="black")

        # sonrisa rosybrown
        panel.create_arc(155, 145, 190, 160, extent=100, style=ARC, start=180, width=2, fill="black", outline="black")
        panel.create_arc(255, 145, 290, 160, extent=100, style=ARC, start=255, width=2, fill="black", outline="black")
        panel.create_oval(195, 170, 245, 180, width=2, fill="pink2", outline="black")

        # Petalos
        panel.create_arc(200, 30, 240, 130, extent=180, start=0, style=CHORD, width=2, fill="yellow2", outline="black")
        panel.create_arc(240, 40, 280, 130, extent=180, start=353, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(275, 58, 315, 145, extent=185, start=340, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(255, 100, 365, 140, extent=190, start=280, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(260, 130, 360, 170, extent=180, start=268, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(245, 200, 360, 165, extent=220, start=225, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(255, 163, 295, 233, extent=215, start=178, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(225, 155, 265, 245, extent=190, start=180, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(170, 155, 215, 245, extent=190, start=170, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(135, 158, 175, 233, extent=210, start=150, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(80, 155, 192, 195, extent=198, start=105, style=CHORD, width=2, fill="yellow2",
                         outline="black")
        panel.create_arc(65, 120, 172, 160, extent=193, start=84, style=CHORD, width=2, fill="yellow2", outline="black")

        panel.create_arc(128, 50, 168, 133, extent=200, start=10, style=CHORD, width=2, fill="yellow2", outline="black")

        panel.create_arc(80, 83, 170, 123, extent=233, start=35, style=CHORD, width=2, fill="yellow2", outline="black")
        panel.create_arc(160, 40, 200, 125, extent=190, start=2, style=CHORD, width=2, fill="yellow2", outline="black")

        # tallo
        panel.create_polygon(210, 200, 210, 250, 220, 290, 235, 330, 230, 380, 230, 410,
                             245, 410, 245, 380, 250, 330, 235, 290, 225, 250, 225, 200, width=1, fill="forestgreen",
                             outline="black")
        # hoja derecha
        panel.create_arc(230, 250, 310, 300, extent=270, start=0, style=CHORD, width=2, fill="forestgreen",
                         outline="darkgreen")
        panel.create_arc(230, 265, 300, 295, extent=105, start=75, style=ARC, width=2, outline="darkgreen")
        # hoja izquierda
        panel.create_arc(125, 250, 215, 300, extent=270, start=270, style=CHORD, width=2, fill="forestgreen",
                         outline="darkgreen")
        panel.create_arc(130, 265, 215, 295, extent=105, start=0, style=ARC, width=2, outline="darkgreen")

        # fondo derecho
        panel.create_arc(245, 300, 360, 410, extent=180, start=0, style=CHORD, width=1, fill="darkgreen",
                         outline="black")
        panel.create_arc(245, 325, 380, 440, extent=170, start=0, style=CHORD, width=2, fill="forestgreen",
                         outline="darkgreen")
        panel.create_arc(240, 340, 365, 460, extent=105, start=35, style=ARC, width=2, fill="forestgreen",
                         outline="darkgreen")
        # fondo izquierdo
        panel.create_arc(115, 310, 235, 400, extent=195, start=345, style=CHORD, width=1, fill="darkgreen",
                         outline="black")
        panel.create_arc(105, 340, 235, 470, extent=170, start=20, style=CHORD, width=2, fill="forestgreen",
                         outline="darkgreen")
        panel.create_arc(135, 350, 240, 490, extent=130, style=ARC, start=8, width=2, fill="black", outline="darkgreen")
        # fondo medio
        panel.create_arc(185, 345, 350, 500, extent=180, start=0, style=CHORD, width=2, fill="forestgreen",
                         outline="darkgreen")
        panel.create_arc(185, 365, 315, 500, extent=130, style=ARC, start=40, width=2, outline="darkgreen")
    elif seleccion == 4:
        panel = Canvas(vs, width=600, height=800, bg="linen")
        panel.pack()
        # cara
        panel.create_polygon(200, 300, 200, 450, 210, 470, 390, 470, 400, 450, 400, 300, width=2, fill="lemonchiffon",
                             outline="black")
        # cabeza
        panel.create_arc(100, 80, 500, 520, extent=180, start=0, style=CHORD, width=2, fill="gold", outline="black")
        # manchas

        panel.create_oval(290, 100, 380, 140, width=1, fill="goldenrod", outline="khaki")  # 1
        panel.create_oval(170, 110, 275, 190, width=1, fill="goldenrod", outline="khaki")  # 2
        panel.create_oval(130, 220, 180, 270, width=1, fill="goldenrod", outline="khaki")  # 3
        panel.create_oval(210, 200, 300, 290, width=1, fill="goldenrod", outline="khaki")  # 4
        panel.create_oval(320, 160, 350, 210, width=1, fill="goldenrod", outline="khaki")  # 5
        panel.create_oval(325, 235, 375, 275, width=1, fill="goldenrod", outline="khaki")  # 6
        panel.create_oval(390, 140, 465, 285, width=1, fill="goldenrod", outline="khaki")  # 7

        # ojos
        panel.create_oval(240, 320, 270, 390, width=1, fill="black", outline="black")
        panel.create_oval(330, 320, 360, 390, width=1, fill="black", outline="black")
        # pupila
        panel.create_oval(245, 325, 265, 355, width=1, fill="white", outline="black")
        panel.create_oval(335, 325, 355, 355, width=1, fill="white", outline="black")
        # boca
        panel.create_arc(260, 390, 340, 440, extent=180, style=ARC, start=180, width=2, fill="black", outline="black")
    elif seleccion == 5:
        panel = Canvas(vs, width=1148, height=700, bg='light blue')
        panel.pack()
        # casa
        panel.create_rectangle(100, 410, 370, 650, width=2, fill='yellow', outline='black')
        # tejado
        panel.create_polygon(70, 409, 400, 409, 245, 200, width=2, fill='red', outline='black')
        # ventanas
        panel.create_rectangle(120, 420, 200, 500, width=2, fill='blue', outline='black')
        panel.create_rectangle(270, 420, 350, 500, width=2, fill='purple', outline='black')
        # Puerta
        panel.create_rectangle(200, 550, 260, 650, width=2, fill='red', outline='black')
        panel.create_line(230, 550, 230, 650, width=2, fill="black")
        panel.create_oval(215, 600, 200, 620, width=2, fill='brown', outline='black')
        # pasto
        panel.create_rectangle(1, 650, 1147, 700, width=2, fill='green', outline='black')
        # arbol
        panel.create_rectangle(600, 410, 570, 650, width=2, fill='brown', outline='black')
        panel.create_oval(700, 550, 480, 350, width=2, fill='green', outline='black')
        # sol
        panel.create_oval(1000, 150, 880, 50, width=2, fill='yellow', outline='black')
        panel.create_line(900, 200, 1000, 1, width=10, fill="yellow")
        panel.create_line(780, 125, 1100, 70, width=10, fill="yellow")
        panel.create_line(1050, 200, 880, 10, width=10, fill="yellow")
    elif seleccion == 6:
        panel = Canvas(vs, 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")
    elif seleccion == 7:
        panel = Canvas(vs, width=200, height=200, bg="yellow")
        panel.pack()
        # Parte negra
        panel.create_polygon(70, 10, 130, 10, 130, 20, 150, 20, 150, 30, 160, 30, 160, 50, 170, 50, 170, 60, 180, 60,
                             180, 130,
                             170, 130, 170, 140, 160, 140, 160, 160, 150, 160, 150, 170, 50, 170, 50, 160, 40, 160, 40,
                             140, 30, 140, 30, 130, 20, 130,
                             20, 60, 30, 60, 30, 50, 40, 50, 40, 30, 50, 30, 50, 20, 70, 20, 70, 10, width=1,
                             fill="black", outline="black")

        # Primera parte blanca
        panel.create_polygon(80, 20, 120, 20, 120, 30, 140, 30, 140, 40, 150, 40, 150, 60, 160, 60, 160, 70, 170, 70,
                             170, 120, 150, 120, 150, 110, 50, 110, 50, 120, 30, 120, 30, 70, 40, 70, 40, 60, 50, 60,
                             50, 40, 60, 40, 60, 30, 80, 30, 80, 20, width=1, fill="white", outline="white")

        # segunda parte blanca
        panel.create_polygon(60, 120, 140, 120, 140, 130, 150, 130, 150, 150, 140, 150, 140, 160, 60, 160, 60, 150,
                             50, 150, 50, 130, 60, 130, 60, 120, width=1, fill="white", outline="white")

        # ojos
        panel.create_rectangle(80, 120, 90, 140, width=1, fill="black", outline="black")
        panel.create_rectangle(110, 120, 120, 140, width=1, fill="black", outline="black")

        # manchas
        panel.create_polygon(80, 70, 120, 70, 120, 80, 130, 80, 130, 100, 120, 100, 120, 110, 80, 110, 80, 100, 70, 100,
                             70, 80, 80, 80, 80, 70, width=1, fill="red", outline="red")
        panel.create_polygon(110, 20, 120, 20, 120, 30, 140, 30, 140, 50, 120, 50, 120, 40, 110, 40, 110, 20, width=1,
                             fill="red", outline="red")
        panel.create_polygon(80, 20, 90, 20, 90, 40, 80, 40, 80, 50, 60, 50, 60, 30, 80, 30, 80, 20, width=1,
                             fill="red", outline="red")
        panel.create_polygon(40, 60, 60, 60, 60, 90, 50, 90, 50, 100, 30, 100, 30, 70, 40, 70, 40, 60, width=1,
                             fill="red", outline="red")
        panel.create_polygon(140, 60, 160, 60, 160, 70, 170, 70, 170, 100, 150, 100, 150, 90, 140, 90, 140, 60, width=1,
                             fill="red", outline="red")
    elif seleccion == 8:
        panel = Canvas(vs, width=400, height=400, bg='red')
        panel.pack()
        panel.create_polygon(60, 120, 100, 180, 140, 120, 100, 60, width=5, fill='blue',
                             outline='green')  # coordenadas de x1,y1,x2,y2 etc etc y caracteristicas de las figura
    elif seleccion == 9:
        canvas = Canvas(vs, width=500, height=500, bg="white")
        canvas.pack()

        canvas.create_polygon(42, 372, 9, 396, -5, 415, -5, 502, 505, 505, 505, 396, 453, 372,
                              fill="BLUE", outline="black", width=2)
        canvas.create_polygon(177, 261, 173, 293, 174, 323, 179, 329, 174, 323, 174, 312, 140, 323, 124, 335, 150, 420,
                              346, 435, 383, 341, 363, 324, 326, 312, 327, 312, 319, 340, 327, 312, 323, 268,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(119, 337, 157, 340, 183, 356, 198, 382, 110, 381,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(365, 337, 325, 340, 301, 356, 282, 382, 367, 381,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(137, 365, 181, 363, 229, 369, 249, 382, 252, 403, 249, 382, 260, 373, 297, 365, 362, 367,
                              368, 482, 98, 482,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(114, 353, 212, 399, 269, 401, 369, 355, 350, 484, 127, 482,
                              fill="blue", outline="black", width=2)
        canvas.create_polygon(138, 325, 119, 319, 136, 373, 183, 422, 237, 460, 267, 457, 335, 399, 367, 331, 369, 313,
                              361, 319, 369, 313, 440, 347, 433, 382, 439, 353,
                              474, 372, 431, 502, 85, 502, 32, 374, 68, 357, 75, 375,
                              67, 357, 68, 346, 119, 319,
                              fill="orange", outline="black", width=2)

        canvas.create_polygon(196, 306, 215, 334, 230, 353, 215, 334,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(304, 306, 289, 334, 270, 353, 289, 334,
                              fill="peach puff", outline="black", width=2)
        canvas.create_polygon(184, 260, 117, 276, 80, 305, 106, 254, 127, 233, 79, 232, 44, 249, 71, 203, 112, 184, 82,
                              165, 24, 165, 84, 125, 144, 108, 134, 55, 91, 1, 206, 43, 240, 89, 268, 88,
                              311, 103, 336, 130, 372, 132, 423, 170, 396, 170, 374, 177, 403, 203, 419, 232, 400, 224,
                              376, 224, 398, 246, 376, 241, 334, 243, 344, 239, 353, 250, 364, 271, 342, 261, 323, 260

                              )
        canvas.create_oval(340, 445, 390, 495, fill="white", outline="black", width=2)
        canvas.create_polygon(180, 260,
                              155, 244,
                              143, 208,
                              155, 193,
                              165, 195, fill="peach puff", outline="black", width=2)

        canvas.create_polygon(320, 260,
                              345, 244,
                              357, 208,
                              345, 193,
                              335, 195, fill="peach puff", outline="black", width=2)

        canvas.create_polygon(240, 325,
                              180, 275,
                              160, 170,
                              330, 170,
                              340, 190,
                              320, 275,
                              260, 325, fill="peach puff", outline="black", width=2)

        canvas.create_polygon(250, 255,
                              250, 275,
                              260, 275,
                              250, 280,
                              240, 275, fill="peach puff3", outline="black", width=2)

        canvas.create_polygon(235, 290,
                              260, 287,
                              265, 290,
                              260, 287, outline="black", width=2)

        canvas.create_polygon(237, 247,
                              233, 253,
                              200, 245,
                              190, 195, fill="white", outline="black", width=2)
        canvas.create_oval(210, 223.5,
                           230, 243, fill="black")
        canvas.create_polygon(240, 250,
                              242, 235,
                              242, 243,
                              180, 180,
                              180, 200,
                              fill="black", outline="black", width=2)

        canvas.create_polygon(263, 247,
                              267, 253,
                              300, 245,
                              310, 195, fill="white", outline="black", width=2)

        canvas.create_oval(290, 223.5,
                           270, 243, fill="black")

        canvas.create_polygon(260, 250,
                              257, 235,
                              258, 243,
                              320, 180,
                              320, 200,
                              fill="black", outline="black", width=2)

        canvas.create_polygon(280, 160,
                              240, 220,
                              225, 265,
                              215, 180,
                              220, 160,
                              223, 183,
                              190, 200,
                              170, 250,
                              155, 170,
                              210, 160)

        canvas.create_polygon(266, 174,
                              296, 206, 311, 245, 321, 204, 313, 156, 256, 121, 220, 174)
        canvas.create_polygon(313, 184, 327, 200, 332, 226, 342, 198, 331, 149, 305, 128, 256, 125)

    elif seleccion == 10:
        poligono = Canvas(vs, width=400, height=400, bg="gray")
        poligono.create_polygon(130, 20, 60, 80, 100, 140, 160, 140, 200, 80, width=3, fill="pink", outline="black")
        poligono.pack()

    elif seleccion == 11:
        panel = Canvas(vs, width=500, height=400, bg='white')
        panel.pack()
        panel.create_polygon(140, 40, 300, 40, 400, 140, 40, 140, width=5, fill='white', outline='black')
        # coordenadas y caracteristica de la figura


    elif seleccion == 12:
        panel = Canvas(vs, 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")

    elif seleccion == 13:
        panel = Canvas(vs, width=300, height=200, bg="black")
        panel.pack()

        # Cuerpo del fantasma
        panel.create_polygon(100, 10, 130, 10, 130, 20, 150, 20, 150, 20, 150, 30, 160, 30, 160, 40, 170, 40, 170, 60,
                             180, 60, 180, 160, 170, 160,
                             170, 150, 160, 150, 160, 140, 150, 140, 150, 150, 140, 150, 140, 160, 130, 160, 130, 140,
                             100, 140, 100, 160,
                             90, 160, 90, 150, 80, 150, 80, 140, 70, 140, 70, 150, 60, 150, 60, 160, 50, 160, 50, 60,
                             60, 60,
                             60, 40, 70, 40, 70, 30, 80, 30, 80, 20, 100, 20, width=1, fill="blue", outline="white")

        # Ojos Fantasma
        panel.create_polygon(80, 50, 100, 50, 100, 70, 80, 70, width=1, fill="white")
        panel.create_polygon(130, 50, 150, 50, 150, 70, 130, 70, width=1, fill="white")

        # Boca Fantasma
        panel.create_polygon(65, 110, 70, 110, 70, 120, 65, 120, width=1, fill="white")
        panel.create_polygon(70, 100, 90, 100, 90, 110, 70, 110, width=1, fill="white")
        panel.create_polygon(90, 110, 110, 110, 110, 120, 90, 120, width=1, fill="white")
        panel.create_polygon(110, 100, 130, 100, 130, 110, 110, 110, width=1, fill="white")
        panel.create_polygon(130, 110, 150, 110, 150, 120, 130, 120, width=1, fill="white")
        panel.create_polygon(150, 100, 170, 100, 170, 110, 150, 110, width=1, fill="white")
        panel.create_polygon(170, 110, 175, 110, 175, 120, 170, 120, width=1, fill="white")

    elif seleccion == 14:
        Escudo = Canvas(vs, width=420, height=420, bg='blue')
        # Primer Arco Rojo
        Escudo.create_oval(40, 40, 400, 400, width=7, fill='red')
        # Arco Gris
        Escudo.create_oval(90, 90, 350, 350, width=7, fill='grey')
        # Segundo Arco Rojo
        Escudo.create_oval(140, 140, 302, 302, width=7, fill='red')
        # Arco Azul
        Escudo.create_oval(163, 163, 278, 278, width=7, fill='blue')
        # Estrella Blanca
        Escudo.create_polygon(222, 170,
                              250, 268,
                              170, 200,
                              270, 200,
                              185, 268, width=5, fill="white", outline="white")

        Escudo.pack()  # para que pueda aparecer el Escudo

    elif seleccion == 15:
        circulo = Canvas(vs, width=210, height=210, bg='magenta')
        circulo.pack()
        circulo.create_oval(20, 20, 200, 200, width=10, fill='yellow')
        circulo.create_oval(90, 92, 70, 70, width=10, fill='black')
        circulo.create_oval(140, 70, 160, 92, width=10, fill='black')
        circulo.create_oval(140, 155, 90, 110, width=10, fill='black')

    elif seleccion == 16:
        dib = Canvas(vs, width=800, height=800, bg="cyan")
        dib.pack(expand=YES, fill=BOTH)
        # gorra
        dib.create_polygon(250, 0, 250, 50, 200, 50, 200, 100, 650, 100, 650, 50, 500, 50, 500, 0, width=1, fill="red",
                           outline="black")
        # cabelloenJota
        dib.create_polygon(200, 100, 200, 150, 250, 150, 250, 250, 350, 250, 350, 200, 300, 200, 300, 150, 350, 150,
                           350, 100, width=1, fill="brown", outline="black")
        # oreja
        dib.create_polygon(200, 150, 200, 250, 250, 250, 250, 150, width=1, fill="yellow", outline="black")
        # cabellodetrasoreja
        dib.create_polygon(200, 150, 150, 150, 150, 250, 200, 250, 200, 150, width=1, fill="brown", outline="black")
        # cabellobajooreja
        dib.create_polygon(200, 250, 200, 300, 250, 300, 250, 250, width=1, fill="brown", outline="black")
        # cara
        dib.create_polygon(350, 100, 350, 150, 300, 150, 300, 200, 350, 200, 350, 250, 250, 250, 250, 350, 550, 350,
                           550, 250, 700, 250, 700, 200, 650, 200, 650, 150, 550, 150, 550, 100, 350, 100, width=1,
                           fill="yellow", outline="black")
        # ojo
        dib.create_polygon(450, 100, 450, 200, 500, 200, 500, 100)
        # Mostacho
        dib.create_polygon(500, 200, 500, 250, 450, 250, 450, 300, 650, 300, 650, 250, 550, 250, 550, 200)
        # Mangaizquierda
        dib.create_polygon(300, 350, 200, 350, 200, 400, 150, 400, 150, 450, 100, 450, 100, 500, 200, 500, 200, 550,
                           250, 550, 250, 500, 300, 500, 300, 350, width=1, fill="red", outline="black")
        # centro
        dib.create_polygon(350, 350, 350, 450, 450, 450, 450, 350, width=1, fill="red", outline="black")
        # Mangaderecha
        dib.create_polygon(500, 350, 500, 500, 550, 500, 550, 550, 600, 550, 600, 500, 700, 500, 700, 450, 650, 450,
                           650, 400, 600, 400, 600, 350, width=1, fill="red", outline="black")
        # Manoizquierda
        dib.create_polygon(100, 500, 100, 650, 200, 650, 200, 600, 250, 600, 250, 550, 200, 550, 200, 500, width=1,
                           fill="yellow", outline="black")
        # Manoderecha
        dib.create_polygon(600, 500, 600, 550, 550, 550, 550, 600, 600, 600, 600, 650, 700, 650, 700, 500, width=1,
                           fill="yellow", outline="black")
        # ropita
        dib.create_polygon(300, 350, 300, 500, 250, 500, 250, 600, 200, 600, 200, 700, 350, 700, 350, 650, 450, 650,
                           450, 700, 600, 700, 600, 600, 550, 600, 550, 500, 500, 500, 500, 350, 450, 350, 450, 450,
                           350, 450, 350, 350, width=1, fill="blue", outline="black")
        # botonizquierdo
        dib.create_polygon(300, 500, 300, 550, 350, 550, 350, 500, width=1, fill="yellow", outline="black")
        # botonderecho
        dib.create_polygon(450, 500, 450, 550, 500, 550, 500, 500, width=1, fill="yellow", outline="black")
        # botaizquierda
        dib.create_polygon(150, 700, 150, 750, 100, 750, 100, 800, 300, 800, 300, 700, width=1, fill="brown",
                           outline="black")
        # botaderecha
        dib.create_polygon(500, 700, 500, 800, 700, 800, 700, 750, 650, 750, 650, 700, width=1, fill="brown",
                           outline="black")

    elif seleccion == 17:
        bat = Canvas(vs, width=280, height=280, bg="blue")
        bat.pack(expand=YES, fill=BOTH)
        # Mascara
        bat.create_polygon(80, 20, 60, 20, 60, 160, 80, 160, 80, 180, 180, 180, 180, 160, 200, 160, 200, 20, 180, 20,
                           180, 40, 160, 40, 160, 60, 100, 60, 100, 40, 80, 40, 80, 20)
        # ojoizquierdo
        bat.create_polygon(100, 100, 100, 120, 120, 120, 120, 100, width=1, fill="white", outline="black")
        # ojoderecho
        bat.create_polygon(140, 100, 140, 120, 160, 120, 160, 100, width=1, fill="white", outline="black")
        # boca
        bat.create_polygon(80, 140, 80, 160, 180, 160, 180, 140, width=1, fill="pink", outline="black")
        # brazos
        bat.create_polygon(80, 160, 40, 160, 40, 200, 220, 200, 220, 160, 180, 160, 180, 180, 80, 180, width=1,
                           fill="gray", outline="black")
        # capa
        bat.create_polygon(60, 200, 60, 260, 80, 260, 80, 220, 180, 220, 180, 260, 200, 260, 200, 200)
        # cinturon
        bat.create_polygon(120, 200, 120, 220, 140, 220, 140, 200, width=1, fill="yellow", outline="black")
        # piernas
        bat.create_polygon(80, 220, 80, 260, 120, 260, 120, 240, 140, 240, 140, 260, 180, 260, 180, 220, width=1,
                           fill="gray", outline="black")
        # restocapa
        bat.create_polygon(120, 240, 120, 260, 140, 260, 140, 240)

    elif seleccion == 18:
        Space = Canvas(vs, width=800, height=500, bg="RED")
        Space.pack(expand=YES, fill=BOTH)

        Space.create_polygon(250, 50, 200, 50, 200, 100, 250, 100, 250, 150, 200, 150, 200, 200, 150, 200, 150, 250,
                             100, 250, 100, 400, 150, 400,
                             150, 300, 200, 300, 200, 450, 350, 450, 350, 400, 250, 400, 250, 350, 500, 350, 500, 400,
                             400, 400, 400, 450, 550, 450, 550, 300, 600, 300, 600, 400,
                             650, 400, 650, 250, 600, 250, 600, 200, 550, 200, 550, 150, 500, 150, 500, 100, 550, 100,
                             550, 50, 450, 50, 450, 150, 300, 150, 300, 50, fill="green", outline="blue", width=6)

        Space.create_polygon(250, 200, 250, 250, 300, 250, 300, 200, fill="white", outline="white", width=6)

        Space.create_polygon(500, 200, 450, 200, 450, 250, 500, 250, fill="white", outline="white", width=6)

    elif seleccion == 19:
        canvas = Canvas(vs, width=500, height=800, bg="White")
        canvas.pack()

        canvas.create_arc(100, 100, 400, 400, start=0, extent=180, fill="green", outline="green")
        canvas.create_oval(175, 150, 200, 175, fill="white", outline="white")
        canvas.create_oval(300, 150, 325, 175, fill="white", outline="white")
        canvas.create_oval(100, 550, 200, 450, fill="green", outline="green")
        canvas.create_polygon(100, 260, 100, 500, 150, 550, 350, 550, 400, 500, 400, 260, fill="green", outline="green")
        canvas.create_oval(300, 550, 400, 450, fill="green", outline="green")
        canvas.create_polygon(160, 550, 160, 625, 220, 625, 220, 550, fill="green", outline="green")
        canvas.create_polygon(280, 550, 280, 625, 340, 625, 340, 550, fill="green", outline="green")
        canvas.create_oval(160, 600, 220, 650, fill="green", outline="green")
        canvas.create_oval(280, 600, 340, 650, fill="green", outline="green")
        canvas.create_polygon(30, 275, 30, 450, 90, 450, 90, 275, fill="green", outline="green")
        canvas.create_oval(30, 250, 90, 300, fill="green", outline="green")
        canvas.create_oval(30, 425, 90, 475, fill="green", outline="green")

        canvas.create_polygon(410, 275, 410, 450, 470, 450, 470, 275, fill="green", outline="green")
        canvas.create_oval(410, 250, 470, 300, fill="green", outline="green")
        canvas.create_oval(410, 425, 470, 475, fill="green", outline="green")

        canvas.create_polygon(160, 130,
                              180, 118,
                              160, 88,
                              140, 100, fill="green", outline="green")
        canvas.create_oval(141, 85, 163, 110, fill="green", outline="green")

        canvas.create_polygon(335, 130,
                              315, 118,
                              335, 88,
                              355, 100, fill="green", outline="green")
        canvas.create_oval(354, 85, 332, 110, fill="green", outline="green")


def funcion_main():
    vp = Tk()
    vp.geometry("300x800+5+5")
    vp.configure(bg="black")
    vp.title("Poligonos grupo A")
    boton1 = Button(vp, text="Perrito", bg="blue", fg="White",
                    command=lambda: funcion(1, "Programa por Ambrocio Laureano"))
    boton1.pack(padx=5, pady=5, fill=X)
    boton2 = Button(vp, text="Angry Bird", bg="blue", fg="White",
                    command=lambda: funcion(2, "Programa por Griselda Maldonado"))
    boton2.pack(padx=5, pady=5, fill=X)
    boton3 = Button(vp, text="Girasol", bg="blue", fg="White",
                    command=lambda: funcion(3, "Programa por Griselda Maldonado"))
    boton3.pack(padx=5, pady=5, fill=X)
    boton4 = Button(vp, text="Hongo", bg="blue", fg="White",
                    command=lambda: funcion(4, "Programa por Griselda Maldonado"))
    boton4.pack(padx=5, pady=5, fill=X)
    boton5 = Button(vp, text="Paisaje", bg="blue", fg="White",
                    command=lambda: funcion(5, "Programa por Manuel Ramirez"))
    boton5.pack(padx=5, pady=5, fill=X)
    boton6 = Button(vp, text="Venom", bg="blue", fg="White",
                    command=lambda: funcion(6, "Programa por Livan Sanchez"))
    boton6.pack(padx=5, pady=5, fill=X)
    boton7 = Button(vp, text="Seta", bg="blue", fg="White",
                    command=lambda: funcion(7, "Programa por Carolina Sauceda"))
    boton7.pack(padx=5, pady=5, fill=X)
    boton8 = Button(vp, text="Rombo", bg="blue", fg="White",
                    command=lambda: funcion(8, "Programa por Carlos Olvera"))
    boton8.pack(padx=5, pady=5, fill=X)
    boton9 = Button(vp, text="Goku", bg="blue", fg="White",
                    command=lambda: funcion(9, "Programa por Santiago Lopez"))
    boton9.pack(padx=5, pady=5, fill=X)
    boton10 = Button(vp, text="Pentagono", bg="blue", fg="White",
                     command=lambda: funcion(10, "Programa por Alondra Adamary"))
    boton10.pack(padx=5, pady=5, fill=X)
    boton11 = Button(vp, text="Cuadrilatero", bg="blue", fg="White",
                     command=lambda: funcion(11, "Programa por Rocio Mahe"))
    boton11.pack(padx=5, pady=5, fill=X)
    boton12 = Button(vp, text="Flor", bg="blue", fg="White",
                     command=lambda: funcion(12, "Programa por Lyvan Lumbreras"))
    boton12.pack(padx=5, pady=5, fill=X)
    boton13 = Button(vp, text="Fantasma", bg="blue", fg="White",
                     command=lambda: funcion(13, "Programa por Fernando Veliz"))
    boton13.pack(padx=5, pady=5, fill=X)
    boton14 = Button(vp, text="Escudo", bg="blue", fg="White",
                     command=lambda: funcion(14, "Programa por Jesus Uribe"))
    boton14.pack(padx=5, pady=5, fill=X)
    boton15 = Button(vp, text="Carita", bg="blue", fg="White",
                     command=lambda: funcion(15, "Programa por Diana Lucia"))
    boton15.pack(padx=5, pady=5, fill=X)
    boton16 = Button(vp, text="Mario Bros", bg="blue", fg="White",
                     command=lambda: funcion(16, "Programa por Alejandro Echavarria"))
    boton16.pack(padx=5, pady=5, fill=X)
    boton17 = Button(vp, text="Batman", bg="blue", fg="White",
                     command=lambda: funcion(17, "Programa por Alejandro Echavarria"))
    boton17.pack(padx=5, pady=5, fill=X)
    boton18 = Button(vp, text="Arcade", bg="blue", fg="White",
                     command=lambda: funcion(18, "Programa por Jaziel Martinez"))
    boton18.pack(padx=5, pady=5, fill=X)
    boton19 = Button(vp, text="Android", bg="blue", fg="White",
                     command=lambda: funcion(19, "Programa por Ivan Gutierrez"))
    boton19.pack(padx=5, pady=5, fill=X)

    vp.mainloop()


funcion_main()

Practica con tkColorChooser programa solo linea.


El tkColoChooser nos permite elegir colores de la gama de colores, lo cual nos abre las siguiente ventana, en la cual se muestran la gama de colores.



# -*-# -*- coding: utf-8 -*-
from Tkinter import *
import tkColorChooser #libreria para obtener la gama de colores

#crecion de la ventana principal
v0 = Tk()
v0.title('Ventana principal')
v0.config(bg = 'brown') #bg para el color de fondo de la ventana
v0.geometry('500x500')#tamaño de la ventana
v0.iconbitmap("descarga.ico")#para cambiar el icono de la ventana


#funciones
def mostrar(num):
    #aparece la gamade colores RGB o en numero hexadecimal
    a=tkColorChooser.askcolor()
    #b=tkColorChooser.askcolor()
    #ventana secundaria
    v1 = Toplevel(v0)
    v1.title('ventana hija')
    v1.protocol('Wn_DELETE_WINDOW',"onexit")#para cerrar la ventana por medio de la cruz
    v1.geometry('300x300')#tamaño de la ventana
    v1.iconbitmap("vhija.ico")  # para cambiar el icono de la ventana
    #condiciones para los botones
    if num == 1:
        canvas1=Canvas(v1,width=200,height=200, bg='white')#(b[1])) esto es para seleccionar el color de fondo# OBJETO DE LA TKINTER   CANVAS(FIGURAS)     200 pixeles de ancho 200 ancho
        canvas1.pack(expand = YES, fill = BOTH)  #DESPLEGAR EL CANVAS, EXPAND QUE SEA EXPANDIBLE
        canvas1.create_line(100,200,200,100, width = 10, fill=(a[1]))#en fil añadimos (a[1]) para que se coloque el color seleccionado en el trazo
    elif num == 2:
        canvas2 = Canvas(v1, width=200, height=200,
                         bg='white')  # OBJETO DE LA TKINTER   CANVAS(FIGURAS)     200 pixeles de ancho 200 ancho
        canvas2.pack(expand=YES, fill=BOTH)  # DESPLEGAR EL CANVAS, EXPAND QUE SEA EXPANDIBLE
        canvas2.create_rectangle(10, 200, 200, 10, width=10, fill=(a[1]))

        # circulo
    elif num == 3:
        canvas3 = Canvas(v1, width=200, height=200,
                         bg='white')  # OBJETO DE LA TKINTER   CANVAS(FIGURAS)     200 pixeles de ancho 200 ancho
        canvas3.pack(expand=YES, fill=BOTH)  # DESPLEGAR EL CANVAS, EXPAND QUE SEA EXPANDIBLE
        canvas3.create_oval(10, 200, 200, 10, width=10, fill=(a[1]))
        # poligono

        elif num == 4:  #El polygono de Hugo
        canvas4 = Canvas(v1, width=200, height=200,
                         bg='white')  # OBJETO DE LA TKINTER   CANVAS(FIGURAS)     200 pixeles de ancho 200 ancho
        canvas4.pack(expand=YES, fill=BOTH)  # DESPLEGAR EL CANVAS, EXPAND QUE SEA EXPANDIBLE
        puntos = [102, 201, 233, 134, 431, 331, 122, 134]
        canvas4.create_polygon(puntos, width=10, fill=(a[1]))

    elif num == 5: #La estrella de zapata
        canvas5 = Canvas(v1, width=200, height=200,
                         bg='white')  # OBJETO DE LA TKINTER   CANVAS(FIGURAS)     200 pixeles de ancho 200 ancho
        canvas5.pack(expand=YES, fill=BOTH)  # DESPLEGAR EL CANVAS, EXPAND QUE SEA EXPANDIBLE
        puntos = [10,40,40,40,50,10,60,40,90,40,65,60,75,90,50,70,25,90,35,60]
        canvas5.create_polygon(puntos, width=10, fill=(a[1]))

def ocultar(ventana):ventana.destray()
def ejecutar(f):v0.after(200,f)



#botones
# V0 donde se va desplegar el boton
b1 = Button(v0, text='Abrir ventana con linea', command=lambda: ejecutar(mostrar(1)))
b1.grid(row=1, column=1)  # desplegar boton

b2=Button(v0,text='Abrir ventana cuadro',command=lambda:ejecutar(mostrar(2)))
b2.grid(row=1,column=2)  #desplegar boton

b3=Button(v0,text='Abrir ventana circulo',command=lambda:ejecutar(mostrar(3)))
b3.grid(row=1,column=3)  #desplegar boton

b4=Button(v0,text='Abrir ventana poligono',command=lambda:ejecutar(mostrar(4)))
b4.grid(row=1,column=4)  #desplegar boton

b5=Button(v0,text='Abrir ventana poligono',command=lambda:ejecutar(mostrar(5)))
b5.grid(row=1,column=5)  #desplegar boton

v0.mainloop()




El resultado de este cogigo es el siguiente:
Nos muestra la ventana con los botones para elegir la figura:


Segun sea la figura que hayamos seleccionado, en cualquier de los casos nos aparecerá la ventana de color, una vez seleccionado el color le damos en aceptar:

La siguiente imagen aparecen todas las figuras creadas, y los colores fueron seleccionados con el tkcolorchooser: