miércoles, 30 de octubre de 2019
models.py proyecto Universidad en Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models | |
# Create your models here. | |
class Alumno(models.Model): | |
ApellidoPaterno= models.CharField(max_length=35) | |
ApellidoMaterno = models.CharField(max_length=35) | |
Nombres = models.CharField(max_length=35) | |
DNI=models.CharField(max_length=8) | |
FechaNacimiento=models.DateField() | |
SEXOS= (('F','Femenino'),('M','Masculino')) | |
sexo=models.CharField(max_length=1,choices=SEXOS,default='M') | |
#foto=models.ImageField(upload_to='photos') | |
def NombreCompleto(self): | |
cadena="{0} {1} {2}" | |
return cadena.format(self.ApellidoPaterno,self.ApellidoMaterno,self.Nombres) | |
def __str__(self): | |
return self.NombreCompleto() | |
class Curso(models.Model): | |
Nombre = models.CharField(max_length=30) | |
Estado = models.BooleanField(default=True) | |
Creditos = models.PositiveIntegerField(default=1) | |
def __str__(self): | |
return "{0} -> {1}".format(self.Nombre,self.Creditos) | |
class Matricula(models.Model): | |
Alumno =models.ForeignKey(Alumno, null=False, blank= False, on_delete= models.CASCADE) | |
Curso = models.ForeignKey(Curso, null=False, blank=False, on_delete=models.CASCADE) | |
FechaMatricula=models.DateTimeField(auto_now=True) | |
def __str__(self): | |
cadena = "{0} inscrito en: {1}" | |
return cadena.format(self.Alumno, self.Curso) | |
Documentacion Libreria Emu8086.inc
emu8086.inc define las siguientes macros :
PUTC char - macro con 1 parámetro, imprime un carácter ASCII en la posición actual del cursor.
GOTOXY col, fila - macro con 2 parámetros, establece la posición del cursor.
PRINT string - macro con 1 parámetro, imprime una cadena. PRINTN string - macro con 1 parámetro, imprime una cadena. Lo mismo que PRINT pero agrega automáticamente "retorno de carro" al final de la cadena.
CURSOROFF - apaga el cursor de texto.
CURSORON - enciende el cursor de texto. Para usar cualquiera de las macros anteriores, simplemente escriba su nombre en algún lugar de su código y, si es necesario, los parámetros emu8086.inc también define los siguientes procedimientos :
PRINT_STRING : procedimiento para imprimir una cadena terminada en nulo en la posición actual del cursor, recibe la dirección de la cadena en el registro DS: SI . Para usarlo declare: DEFINE_PRINT_STRING antes de la directiva END .
PTHIS : procedimiento para imprimir una cadena terminada en nulo en la posición actual del cursor (igual que PRINT_STRING), pero recibe la dirección de la cadena desde la Pila. La cadena TERMINADA A CERO debe definirse justo después de la instrucción CALL. Por ejemplo: CALL PTHIS db 'Hello World!', 0 Para usarlo declare: DEFINE_PTHIS antes de la directiva END . GET_STRING : procedimiento para obtener una cadena terminada en nulo de un usuario, la cadena recibida se escribe en el búfer en DS: DI , el tamaño del búfer debe estar en DX . El procedimiento detiene la entrada cuando se presiona 'Enter'. Para usarlo declare: DEFINE_GET_STRING antes de la directiva END . CLEAR_SCREEN : procedimiento para borrar la pantalla (que se realiza al desplazar la ventana completa de la pantalla) y establecer la posición del cursor en la parte superior. Para usarlo declare: DEFINE_CLEAR_SCREEN antes de la directiva END . SCAN_NUM : procedimiento que obtiene el número FIRMADO de varios dígitos del teclado y almacena el resultado en el registro CX . Para usarlo declare: DEFINE_SCAN_NUM antes de la directiva END . PRINT_NUM : procedimiento que imprime un número firmado en el registro AX . Para usarlo declare: DEFINE_PRINT_NUM y DEFINE_PRINT_NUM_UNS antes de la directiva END . PRINT_NUM_UNS : procedimiento que imprime un número sin firma en el registro AX . Para usarlo declare: DEFINE_PRINT_NUM_UNS antes de la directiva END . Para utilizar cualquiera de los procedimientos anteriores, primero debe declarar la función en la parte inferior de su archivo (pero antes de END ), y luego usar la instrucción CALL seguida de un nombre de procedimiento.
PUTC char - macro con 1 parámetro, imprime un carácter ASCII en la posición actual del cursor.
GOTOXY col, fila - macro con 2 parámetros, establece la posición del cursor.
PRINT string - macro con 1 parámetro, imprime una cadena. PRINTN string - macro con 1 parámetro, imprime una cadena. Lo mismo que PRINT pero agrega automáticamente "retorno de carro" al final de la cadena.
CURSOROFF - apaga el cursor de texto.
CURSORON - enciende el cursor de texto. Para usar cualquiera de las macros anteriores, simplemente escriba su nombre en algún lugar de su código y, si es necesario, los parámetros emu8086.inc también define los siguientes procedimientos :
PRINT_STRING : procedimiento para imprimir una cadena terminada en nulo en la posición actual del cursor, recibe la dirección de la cadena en el registro DS: SI . Para usarlo declare: DEFINE_PRINT_STRING antes de la directiva END .
PTHIS : procedimiento para imprimir una cadena terminada en nulo en la posición actual del cursor (igual que PRINT_STRING), pero recibe la dirección de la cadena desde la Pila. La cadena TERMINADA A CERO debe definirse justo después de la instrucción CALL. Por ejemplo: CALL PTHIS db 'Hello World!', 0 Para usarlo declare: DEFINE_PTHIS antes de la directiva END . GET_STRING : procedimiento para obtener una cadena terminada en nulo de un usuario, la cadena recibida se escribe en el búfer en DS: DI , el tamaño del búfer debe estar en DX . El procedimiento detiene la entrada cuando se presiona 'Enter'. Para usarlo declare: DEFINE_GET_STRING antes de la directiva END . CLEAR_SCREEN : procedimiento para borrar la pantalla (que se realiza al desplazar la ventana completa de la pantalla) y establecer la posición del cursor en la parte superior. Para usarlo declare: DEFINE_CLEAR_SCREEN antes de la directiva END . SCAN_NUM : procedimiento que obtiene el número FIRMADO de varios dígitos del teclado y almacena el resultado en el registro CX . Para usarlo declare: DEFINE_SCAN_NUM antes de la directiva END . PRINT_NUM : procedimiento que imprime un número firmado en el registro AX . Para usarlo declare: DEFINE_PRINT_NUM y DEFINE_PRINT_NUM_UNS antes de la directiva END . PRINT_NUM_UNS : procedimiento que imprime un número sin firma en el registro AX . Para usarlo declare: DEFINE_PRINT_NUM_UNS antes de la directiva END . Para utilizar cualquiera de los procedimientos anteriores, primero debe declarar la función en la parte inferior de su archivo (pero antes de END ), y luego usar la instrucción CALL seguida de un nombre de procedimiento.
martes, 29 de octubre de 2019
Usuario y Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Tkinter import * | |
import tkMessageBox | |
global bandera, bandera1, bandera2, bandera3, bandera4 | |
bandera=0 | |
bandera1=0 | |
bandera2=0 | |
bandera3=0 | |
bandera4=0 | |
class app(): | |
def __init__(self): | |
self.ventana= Tk() | |
self.ventana.title('Nombre de Usario y contrasna') | |
self.ventana.geometry('500x500') | |
self.inicio() | |
self.ventana.mainloop() | |
def inicio(self): | |
self.etiqueta = Label(self.ventana,text='Dame Usuario:',font=("Arial", 12, "bold")) | |
self.etiqueta.grid(row=2, column=4, padx=(20,20), | |
pady=(20,20)) | |
self.usuario=StringVar() | |
self.ent_usuario=Entry(self.ventana,width=12,font=("Arial", 12), | |
textvariable=self.usuario) | |
self.ent_usuario.grid(row=2, column=5, padx=(20,20), | |
pady=(20,20)) | |
self.etiqueta2 = Label(self.ventana, text='Dame Password:',font=("Arial", 12, "bold")) | |
self.etiqueta2.grid(row=4, column=4, padx=(20, 20), | |
pady=(20, 20)) | |
self.password = StringVar() | |
self.ent_password = Entry(self.ventana, width=12,font=("Arial", 12), | |
textvariable=self.password) | |
self.ent_password.grid(row=4, column=5, padx=(20, 20), | |
pady=(20, 20)) | |
self.boton=Button(self.ventana, text='validar Usuario', | |
command= lambda: self.valida(self.ent_usuario.get())).place (x=310,y=15) | |
self.boton=Button(self.ventana, text='validar Contraseña', | |
command= lambda: self.valida1(self.ent_password.get())).place (x=310,y=85) | |
def valida(self,entrada1): | |
#self.ent_usuario=entrada1 | |
if len(entrada1) < 6: | |
tkMessageBox.showerror('Incorrecto Tamaño', | |
'Tiene que ser mayor de 6 caracteres') | |
self.ent_usuario.delete(0,'end') | |
#self.ventana.destroy() | |
#return app() | |
if len(entrada1) > 12: | |
tkMessageBox.showerror('Incorrecto Tamaño', | |
'No puede contener mas de 12 caracteres') | |
self.ent_usuario.delete(0, 'end') | |
#self.ventana.destroy() | |
#return app() | |
if (entrada1).isalnum() == FALSE: | |
tkMessageBox.showerror('Error', 'El usuario debe tener solo numeros o letras') | |
self.ent_usuario.delete(0, 'end') | |
#self.ventana.destroy() | |
#return app() | |
if len(entrada1) > 5 and len(entrada1) < 12 and (entrada1).isalnum() == TRUE: | |
tkMessageBox.showinfo('usuarios aceptado', 'El usuario es correcto') | |
def valida1(self, entrada2): | |
self.ent_password = entrada2 | |
for i in entrada2: # ciclo for que recorre caracter por caracter en la contraseña | |
if i.isspace() == True: # true tiene espacio | |
# print 'tiene espacio' | |
# print 'caraacter:',i | |
bandera = 0 | |
else: | |
bandera = 1 | |
# print bandera | |
if i.isupper() == True: #true tiene mayusculas | |
# print 'tiene mayuscualas' | |
# print 'caracter: ',i | |
bandera1 = 1 | |
# print bandera1 | |
if i.islower() == True: #true tiene minusculas | |
# print ' tiene minusculas' | |
# print 'caracter:', i | |
bandera2 = 1 | |
# print bandera2 | |
if i.isdigit() == True: #tiene numero | |
# print 'tiene numero' | |
# print 'caracter: ', i | |
bandera3 = 1 | |
# print bandera3 | |
if bandera == 0: | |
#print "el password no puede tener espacios" | |
tkMessageBox.showerror('Error', 'El password no puede tener espacios') | |
self.ent_password.delete(0, 'end') | |
#self.ventana.destroy() | |
#return app() | |
elif len(entrada2) < 8 and bandera == 1: | |
#print("el password no puede ser menor de 8 caracteres") | |
#bandera4 = 1 | |
tkMessageBox.showerror('Error', 'El password no puede ser menor de 8 caracteres') | |
self.ventana.destroy() | |
return app() | |
# 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 | |
elif bandera == 1 and bandera1 == 1 and bandera2 == 1 and bandera3 == 1 : | |
#print("la contraseña es segura: tiene letras mayusculas, minusculas, numeros y al menos un caracter no alfanumerico") | |
tkMessageBox.showinfo('Passwor Correcto', 'El password es Seguro:tiene letras mayusculas, minusculas, numeros y al menos un caracter no alfanumerico ') | |
#self.ventana.destroy() | |
#return app() | |
self.etiqueta3 = Label(self.ventana,text='Fin de Validacion', | |
font=("agency fb",14)) | |
self.etiqueta3.grid(row=6, column=4, padx=(20,20), | |
pady=(20,20)) | |
self.etiqueta4 = Label(self.ventana,text='Esta es un version 3', | |
font=("agency fb", 14)) | |
self.etiqueta4.grid(row=7, column=4, padx=(20,20), | |
pady=(20,20)) | |
app = app() | |
Radiobutton Ejemplo 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
tk = Tk() | |
variable = StringVar() | |
def prueba(): | |
print("Se ha elegido la opcion" + variable.get()) | |
radiobutton1 = Radiobutton(text="Opcion 1", variable=variable, value=1, command=prueba) | |
radiobutton2 = Radiobutton(text="Opcion 2", variable=variable, value=2, command=prueba) | |
radiobutton3 = Radiobutton(text="Opcion 3", variable=variable, value=3, command=prueba) | |
radiobutton1.pack() | |
radiobutton2.pack() | |
radiobutton3.pack() | |
variable.get() | |
tk.mainloop() |
CheckButton Ejemplo 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Tkinter import * | |
root = Tk() | |
root.config(width=350, height=250) | |
root.title("Aplicación de escritorio en Tk") | |
frame = Frame(root) | |
frame.place(x=0, y=0, width=350, height=250) | |
button = Button(frame, text="Hola mundo!") | |
button.place(x=50, y=50) | |
textbox = Entry(frame) | |
textbox.insert(0, "Ingrese su nombre...") | |
textbox.place(x=50, y=100) | |
checkbox = Checkbutton(frame, text="Opción 1") | |
checkbox.place(x=50, y=150) | |
root.mainloop() |
CheckButton Ejemplo 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Tkinter import * | |
def seleccionar(): | |
cadena = "" | |
if (leche.get()): | |
cadena += "Con leche" | |
else: | |
cadena += "Sin leche" | |
if (azucar.get()): | |
cadena += " y con azúcar" | |
else: | |
cadena += " y sin azúcar" | |
monitor.config(text=cadena) | |
# Configuración de la raíz | |
root = Tk() | |
root.title("Cafetería") | |
root.config(bd=15) | |
leche = IntVar() # 1 si, 0 no | |
azucar = IntVar() # 1 si, 0 no | |
imagen = PhotoImage(file="image.gif") | |
Label(root, image=imagen).pack(side="left") | |
frame = Frame(root) | |
frame.pack(side="left") | |
Label(frame, text="¿Cómo quieres el café?").pack(anchor="w") | |
Checkbutton(frame, text="Con leche", variable=leche, onvalue=1, | |
offvalue=0, command=seleccionar).pack(anchor="w") | |
Checkbutton(frame, text="Con azúcar", variable=azucar, onvalue=1, | |
offvalue=0, command=seleccionar).pack(anchor="w") | |
monitor = Label(frame) | |
monitor.pack() | |
# Finalmente bucle de la aplicación | |
root.mainloop() |
CheckButton Ejemplo1 python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Tkinter import * | |
def seleccionar(): | |
cadena = "" | |
if (leche.get()): | |
cadena += "Con leche" | |
else: | |
cadena += "Sin leche" | |
if (azucar.get()): | |
cadena += " y con azúcar" | |
else: | |
cadena += " y sin azúcar" | |
monitor.config(text=cadena) | |
# Configuración de la raíz | |
root = Tk() | |
root.title("Cafetería") | |
root.config(bd=15) | |
leche = IntVar() # 1 si, 0 no | |
azucar = IntVar() # 1 si, 0 no | |
#imagen = PhotoImage(file="imagen.gif") | |
#Label(root, image=imagen).pack(side="left") | |
frame = Frame(root) | |
frame.pack(side="left") | |
Label(frame, text="¿Cómo quieres el café?").pack(anchor="w") | |
Checkbutton(frame, text="Con leche", variable=leche, onvalue=1, | |
offvalue=0, command=seleccionar).pack(anchor="w") | |
Checkbutton(frame, text="Con azúcar", variable=azucar, onvalue=1, | |
offvalue=0, command=seleccionar).pack(anchor="w") | |
monitor = Label(frame) | |
monitor.pack() | |
# Finalmente bucle de la aplicación | |
root.mainloop() |
miércoles, 23 de octubre de 2019
Clase,objeto y atributo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Humano: | |
def __init__(self): | |
self.edad = 25 # aqui le doy un atributo a mi objeto | |
print 'soy un humano' | |
def hablar(self,mensaje): | |
print mensaje | |
pedro = Humano() | |
raul= Humano() | |
print 'Soy Pedro y tengo', pedro.edad | |
print 'Soy Raul y tengo', raul.edad | |
pedro.hablar('Hola') | |
raul.hablar('Hola Pedro') |
Clases ,Objetos en Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Humano: | |
def __init__(self): | |
print 'soy un humano' | |
def hablar(self,mensaje): | |
print mensaje | |
pedro = Humano() | |
raul= Humano() | |
pedro.hablar('Hola') | |
raul.hablar('Hola Pedro') |
Contraseña ver 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
from Tkinter import * | |
import tkMessageBox | |
def valida2(): | |
bandera = 0 # se pondra en 1 si encuentra espacios | |
bandera1 = 0 # se pondra en uno si encuentra mayusculas | |
bandera2 = 0 # se pondra en uno si encuentra minusculas | |
bandera3 = 0 # se pondra en uno si encuentra un numero | |
bandera4 = 0 # cambia a uno si tiene un espacio y es menor a 8 caract | |
palabra= ent_pass.get() | |
y = palabra.isalnum() # si es alfanumérica retona True | |
print y | |
for i in palabra: # ciclo for que recorre caracter por caracter en la contraseña | |
if i.isspace() == True: | |
print 'tiene espacio' | |
print 'caraacter:',i | |
bandera = 1 | |
print bandera | |
if i.isupper() == True: | |
print 'tiene mayuscualas' | |
print 'caracter: ',i | |
bandera1 = 1 | |
print bandera1 | |
if i.islower() == True: | |
print ' tiene minusculas' | |
print 'caracter:',i | |
bandera2 = 1 | |
print bandera2 | |
if i.isdigit() == True: | |
print 'tiene numero' | |
print 'caracter: ',i | |
bandera3 = 1 | |
print bandera3 | |
if bandera == 1: | |
print "el password no puede tener espacios" | |
if len(ent_pass.get()) < 8 and bandera==1: | |
print("el password no puede ser menor de 8 caracteres") | |
bandera4 = 1 | |
#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 bandera == 0 and bandera1 == 1 and bandera2 == 1 and bandera3 == 1 and y == False and bandera4 == 0: | |
print("la contraseña es segura: tiene lestras mayusculas, minusculas, numeros y al menos un caracter no alfanumerico") | |
else: | |
print (" la contraseña no es segura") | |
def validar(): | |
if len(ent_usuario.get()) < 6 : | |
tkMessageBox.showerror('Error', 'El usuario debe tener al menos 6 caracteres') | |
if (ent_usuario.get()).isalnum() == FALSE : | |
tkMessageBox.showerror('Error', 'El usuario debe tener solo numeros o letras') | |
if len(ent_usuario.get()) > 12 : | |
tkMessageBox.showerror('Error', 'El usuario no puede tener mas de 12 caracteres') | |
if len(ent_usuario.get()) > 5 and len(ent_usuario.get()) < 12 and (ent_usuario.get()).isalnum() == TRUE: | |
tkMessageBox.showinfo('usuarios aceptado', 'El usuario es correcto') | |
ventana= Tk() | |
ventana.title('Validar Password') | |
ventana. geometry('600x400') | |
vp = Frame(ventana) #estamos utilizando el objeto frame | |
vp.grid(column=0, row=0, padx =(50,50), pady=(10,10)) | |
vp.columnconfigure(0, weigh=1) | |
vp.rowconfigure(0, weight =1) | |
etiqueta = Label(vp,text='Ingrese el nombre de Usuario: ') | |
etiqueta.grid(row=2, column=4, padx=(20,20), pady=(20,20)) | |
usuario = "" | |
ent_usuario = Entry(vp, width=12, textvariable=usuario) | |
ent_usuario.grid(row=2, column=5, padx=(20,20), pady=(20,20)) | |
Boton = Button(vp, text='Validar usuario', command= validar) | |
Boton.grid(row=2, column=6, padx=(20,20), pady=(20,20)) | |
#etiqueta3= Label(vp, text="El password elegido debe contener letras minúsculas, mayúsculas, números y al menos 1 carácter no alfanumérico ") | |
#etiqueta3.grid(row=3, column=6, padx=(20,20), pady=(20,20)) | |
etiqueta2 = Label(vp, text='Ingrese el Password: ') | |
etiqueta2.grid(row=4, column=4, padx=(20, 20), pady=(20, 20)) | |
password = "" | |
ent_pass = Entry(vp, width=10, textvariable=password) | |
ent_pass.grid(row=4, column=5) | |
Boton2 = Button(vp, text='Validar passw:', command=valida2) | |
Boton2.grid(row=4, column=6, padx=(20,20), pady=(20,20)) | |
ventana.mainloop() |
contraseña ver 1.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
from Tkinter import * | |
import tkMessageBox | |
def valida(): | |
if len(ent_usuario.get()) < 6 : | |
tkMessageBox.showerror("INCORRECTO TAMAÑO","TIENE QUE SE MAYOR A 6 CARACTERES") | |
if len(ent_usuario.get()) > 12: | |
tkMessageBox.showerror("INCORRECTO TAMAÑO", "TIENE QUE MENOR A 12 CARACTERES") | |
ventana= Tk() | |
ventana.title ('Validadando ContraseNas') | |
ventana.geometry('500x300') | |
vp = Frame(ventana) #estamos utilizando el objeto frame | |
vp.grid(column=0, row=0, padx =(50,50), pady=(10,10)) | |
vp.columnconfigure(0, weigh=1) | |
vp.rowconfigure(0, weight =1) | |
etiqueta= Label(vp, text='Dame el nombre del Ususarios: ') | |
etiqueta.grid(row=2, column=4, padx=(20,20), pady=(20,20)) | |
usuario="" | |
ent_usuario = Entry(vp, width=12, textvariable= usuario) | |
ent_usuario.grid(row=2, column=5, padx=(20,20), pady=(20,20)) | |
etiqueta1= Label(vp, text='Dame la contraseña: ') | |
etiqueta1.grid(row=4, column=4, padx=(20,20), pady=(20,20)) | |
contrasena="" | |
ent_contrasena = Entry(vp, width=12, show='*', textvariable= contrasena) | |
ent_contrasena.grid(row=4, column=5, padx=(20,20), pady=(20,20)) | |
boton=Button(vp, text='Validar', command=valida ) | |
boton.grid(row=6,column=3,padx=(20,20), pady=(20,20)) | |
Ejemplos Cuadros de Dialogo para la GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
from tkMessageBox import * | |
def main(): | |
showinfo("Title", "Your message here") | |
showerror("An Error", "Oops!") | |
showwarning("Title", "This may not work...") | |
askyesno("Title", "Do you love me?") | |
askokcancel("Title", "Are you well?") | |
askquestion("Title", "How are you?") | |
askretrycancel("Title", "Go again?") | |
askyesnocancel("Title", "Are you well?") | |
main() |
Caja Dialogo Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# www.pythondiario.com | |
from Tkinter import * | |
from tkMessageBox import * | |
def pregunta(): | |
showerror("Pregunta", "Discuple, no hay preguntas disponibles") | |
def devolucion(): | |
if askyesno('Verificar', '¿Realmente quiere salir?'): | |
showwarning('Si', 'No está implementado') | |
else: | |
showinfo('No', 'Salir fue cancelado') | |
Button(text='Salir', command=devolucion).pack(fill=X) | |
Button(text='Pregunta', command=pregunta).pack(fill=X) | |
mainloop() |
martes, 22 de octubre de 2019
Hola Mundo Ensamblador con Offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.MODEL SMALL | |
.STACK | |
.DATA | |
CADENA1 DB 'HOLAMUNDO $' | |
CADENA2 DB 'HOLAMUNDO2 $' | |
.CODE | |
PROGRAMA: | |
MOV AX,@DATA | |
MOV DS,AX | |
MOV DX,OFFSET CADENA1 | |
MOV AH,9 | |
INT 21H | |
MOV DX,OFFSET CADENA2 | |
MOV AH,9 | |
INT 21H | |
END PROGRAMA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CR EQU 13 | |
LF EQU 0Ah | |
DATOS SEGMENT | |
MENSAJE DB CR, LF, 'Hola mundo en Turbo Assambler', CR, LF, '$' | |
DATOS ENDS | |
PILA SEGMENT STACK | |
DB 64 DUP('PILA') | |
PILA ENDS | |
CODIGO SEGMENT | |
HM PROC FAR | |
ASSUME CS : CODIGO, DS : DATOS, SS : PILA | |
MOV AX, DATOS | |
MOV DS, AX | |
LEA DX, MENSAJE | |
MOV AH, 9 | |
INT 21H | |
MOV AX, 4C00H | |
INT 21H | |
HM ENDP | |
CODIGO ENDS | |
END HM |
Hola mundo! Ensamblador Ejemplo2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CODE SEGMENT | |
ASSUME CS:CODE, DS:CODE, SS:CODE, ES:CODE | |
ORG 100H | |
principio: | |
mov ah,0 | |
int 16h | |
mov ah, 0Fh | |
mov ah, 0 | |
int 10h | |
lea dx, mensaje_a_mostrar | |
mov ah, 9h | |
int 21h | |
int 20h | |
mensaje_a_mostrar db "Hola Mundo!$",0 | |
CODE ENDS | |
end principio |
Hola mundo! Ensamblador Ejemplo 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CODE SEGMENT | |
ASSUME CS:CODE, DS:CODE, SS:CODE, ES:CODE | |
ORG 100H | |
principio: | |
mov ah, 0Fh | |
mov ah, 0 | |
int 10h | |
lea dx, mensaje_a_mostrar | |
mov ah, 9h | |
int 21h | |
int 20h | |
mensaje_a_mostrar db "Hola Mundo!$",0 | |
CODE ENDS | |
end principio |
Django de Python con Mysql
No olvidar instalar el modulo que se ocupa para conectar Django con Mysql
Descargar el siguiente archivo auxiliar que permitirá poder establecer la conexión entre django y MYSQL: https://drive.google.com/open?id=1ZseQPHsGmICJ-oyhre0U-3Fo2R_fStOT
Pasarlo a la carpeta donde se creo el proyecto.
Ir al CDM e instalarlo con el comando PIP
Crear nuestra bases de Datos en Mysql (recuerda que la puedes hacer desde el Workbench
Bases de Datos Relacionales!! tomar video:
Esta Conferencia se impartirá el jueves vía remota, como el cupo sera limitado favor de ponerse de acuerdo, para la toma de la conferencia en vídeo....
es el jueves 24 a las 19:00 hrs (es tarea para las materias de Graficacion, Admon de Base de Datos y Lenguaje de Interfaz)
lunes, 21 de octubre de 2019
Metodos, Clases, y la Gui con Pyqt4 ----- hacer Ejercicio practicando la GUI con Pyhton
http://pythoninicios.blogspot.com/2015/09/validar-usuario-y-contrasena-en-python.html
miércoles, 16 de octubre de 2019
poligonos enero-jun 2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Tkinter import * | |
import tkColorChooser | |
def funcion(seleccion, figura): | |
vs = Toplevel() | |
vs.configure(bg="gray") | |
vs.title(figura) | |
if seleccion == 1: | |
panel = Canvas(vs, width=300, height=250, bg='white') # dibujar algo, un lienzo, figuras | |
panel.pack(expand=YES, fill=BOTH) # para expandir la ventana | |
# Cuerpo completo | |
panel.create_polygon(20, 10, 20, 10, 50, 10, 50, 20, 100, 20, 100, 10, 130, 10, 130, 20, 140, 20, 140, 50, 130, | |
50, 130, 60, 120, 60, 120, 150, 110, 50, 110, 70, 120, 70, 120, 110, 130, 110, 130, 120, | |
140, 120, 140, 130, 150, | |
130, 150, 140, 160, 140, 160, 150, 180, 150, 180, 130, 170, 130, 170, 120, 160, 120, 160, | |
100, 180, 100, | |
180, 110, 190, 120, 190, 120, 200, 120, 220, 130, 210, 130, 210, 210, 70, 210, 70, 190, 80, | |
190, 80, 160, 70, | |
160, 70, 150, 60, 150, 60, 130, 50, 130, 50, 120, 40, 120, 40, 110, 30, 110, 30, 70, 40, | |
70, 40, 50, 30, 50, 30, | |
60, 20, 60, 20, 50, 10, 50, 10, 20, 20, 20, 20, 10, width=7, fill="black", outline="black") | |
# Color cafe oreja izq | |
panel.create_polygon(50, 20, 50, 30, 40, 30, 40, 40, 30, 40, 30, 50, 20, 50, 20, 20, 50, 20, width=5, | |
fill="brown", outline="brown") | |
# Color cafe oreja derecha | |
panel.create_polygon(130, 20, 130, 50, 120, 50, 120, 40, 110, 40, 110, 30, 100, 30, 100, 20, 130, 20, width=5, | |
fill="brown", outline="brown") | |
# Cara | |
panel.create_polygon(100, 30, 50, 30, 50, 70, 40, 70, 40, 110, 50, 110, 50, 120, 70, 120, 70, 110, 80, 110, 80, | |
120, | |
100, 120, 100, 110, 110, 110, 110, 70, 100, 70, 100, 30, width=5, fill="white", | |
outline="white") | |
# Ojo izq1 | |
panel.create_polygon(60, 50, 60, 60, 70, 60, 70, 50, 60, 50, width=5, fill="black", outline="black") | |
# Mancha en el ojo | |
panel.create_polygon(100, 40, 70, 40, 70, 70, 100, 70, 100, 40, width=6, fill="brown", outline="brown") | |
# Ojo derecho | |
panel.create_polygon(80, 50, 80, 60, 90, 60, 90, 50, 80, 50, width=5, fill="black", outline="black") | |
# Nariz | |
panel.create_polygon(90, 80, 90, 100, 60, 100, 60, 80, 90, 80, width=6, fill="black", outline="black") | |
# Lengua | |
panel.create_polygon(80, 120, 70, 120, 70, 150, 80, 150, 80, 120, width=5, fill="pink", outline="pink") | |
# Cuerpo mitad 1 | |
panel.create_polygon(120, 110, 120, 190, 130, 190, 130, 200, 110, 200, 110, 150, 100, 150, 100, 200, 80, 200, | |
80, 190, | |
90, 190, 90, 130, 100, 130, 100, 120, 110, 120, 110, 110, 120, 110, width=5, fill="white", | |
outline="white") | |
# Cuerpo mitad 2 | |
panel.create_polygon(200, 130, 200, 200, 170, 200, 170, 190, 180, 190, 180, 180, 170, 180, 170, 170, 160, 190, | |
160, 200, 140, 200, | |
140, 190, 130, 190, 130, 160, 180, 160, 180, 150, 190, 150, 190, 130, 200, 130, width=5, | |
fill="white", outline="white") | |
# Cola | |
panel.create_polygon(180, 110, 170, 110, 170, 120, 180, 120, 180, 130, 190, 130, 190, 120, 180, 120, 180, 110, | |
width=5, fill="brown", outline="brown") | |
# Mancha lomo | |
panel.create_polygon(130, 120, 120, 120, 120, 150, 130, 150, 130, 160, 160, 160, 160, 150, 150, 150, | |
150, 140, 140, 140, 140, 130, 140, 130, 140, 120, 120, 120, width=3, fill="brown", | |
outline="brown") | |
elif seleccion == 2: | |
panel = Canvas(vs, width=250, height=500, bg='white') | |
panel.pack() | |
# ELRICHMC | |
# Brazo izquierdo | |
panel.create_polygon(6, 126, 22, 122, 82, 124, 82, 324, 14, 330, 6, 318, width=1, fill="#0a0a08") # Brazo base | |
# | |
# Brazo derecho | |
panel.create_polygon(186, 146, 232, 146, 232, 312, 188, 314, width=1, fill="#0a0a08") # Brazo base | |
# | |
# Piernas | |
panel.create_polygon(62, 442, 77, 415, 98, 414, 98, 369, 115, 368, 115, 310, | |
165, 309, 165, 362, 180, 360, 187, 401, 185, 441, | |
88, 457, width=1, fill="#898989") | |
# | |
# Pies | |
panel.create_polygon(63, 470, 63, 442, 88, 457, 185, 441, 185, 468, 88, 485, width=1, fill="#282828") | |
# | |
# Camisa | |
panel.create_polygon(126, 179, 138, 179, 138, 295, 165, 295, 165, 310, | |
114, 310, 114, 297, 125, 297, width=1, fill="#181917") # Parte negra | |
panel.create_polygon(125, 165, 151, 165, 151, 310, 138, 310, 138, 180, | |
125, 180, width=1, fill="#861400") # Parte roja | |
# | |
# Cuerpo/capa | |
panel.create_polygon(58, 449, 58, 326, 81, 324, 81, 132, 186, 134, 235, 142, 234, 312, | |
190, 315, 190, 402, 175, 362, 164, 362, 165, 296, 150, 296, | |
151, 166, 126, 165, 126, 298, 114, 298, 116, 368, 100, 369, | |
100, 414, 86, 417, 80, 414, width=1, fill="#0a0b08") | |
# | |
# Cara de ElRichMC | |
panel.create_polygon(102, 10, 202, 22, 202, 137, 104, 132, width=1, fill="#333333") # Cara frontal | |
panel.create_polygon(52, 32, 102, 10, 104, 132, 52, 133, width=1, fill="#1c1c1c") # Parte trasera | |
panel.create_polygon(116, 72, 142, 72, 142, 88, 116, 86, width=1, fill="#060606") # Ojo izquierdo | |
panel.create_polygon(168, 76, 190, 78, 192, 92, 166, 90, width=1, fill="#060606") # Ojo derecho | |
panel.create_polygon(128, 104, 180, 106, 180, 121, 128, 118, width=1, fill="#060606") # Boca (sho te amo) | |
# | |
# Decoración | |
panel.create_polygon(6, 126, 22, 122, 82, 124, 82, 138, 24, 136, 6, 140, width=1, | |
fill="#530800") # Decoración - capa roja | |
panel.create_polygon(5, 142, 6, 157, 9, 157, 11, 156, 11, 141, 18, 139, 18, 155, 21, 155, | |
23, 154, 23, 138, 31, 137, 31, 153, 37, 153, 38, 154, 46, 154, | |
46, 138, 62, 138, 63, 153, 64, 155, 78, 155, 78, 139, 84, 139, | |
84, 155, 113, 156, 113, 173, 126, 173, 126, 143, 100, 143, | |
99, 135, 88, 135, 88, 140, width=1, | |
fill="#d3ac00") # Decoración - capa roja / decoración | |
panel.create_polygon(186, 146, 232, 146, 234, 132, 214, 132, 214, 142, 186, 140, width=1, | |
fill="#530800") # Decoración - capa roja | |
panel.create_polygon(235, 148, 235, 161, 224, 161, 224, 147, 211, 146, 211, 160, 199, 160, | |
199, 146, 195, 147, 193, 159, 168, 159, 167, 174, 154, 175, | |
154, 181, 151, 180, 151, 153, 155, 152, 155, 145, 175, 146, | |
176, 139, 185, 140, 186, 146, 195, 147, width=1, | |
fill="#d3ac00") # Decoración - capa roja / decoración | |
elif seleccion == 3: | |
panel = Canvas(vs, width=220, height=460, bg="white") | |
panel.pack() | |
# Sombra | |
panel.create_polygon(60, 10, 150, 10, 150, 20, 160, 20, 160, 130, 150, 130, 150, 140, 170, 140, 170, 150, | |
180, 150, 180, 160, 190, 160, 190, 180, 200, 180, 200, 240, 190, 240, 190, 250, 180, 250, | |
180, 260, 170, 260, 170, 280, 160, 280, 160, 340, 170, 340, 170, 400, 180, 400, 180, 410, | |
190, 410, 190, 420, 200, 420, 200, 440, 120, 440, 120, 360, 110, 360, 110, 360, 110, 320, | |
100, 320, 100, 360, 90, 360, 90, 440, 10, 440, 10, 420, 20, 420, 20, 410, 30, 410, 30, 400, | |
40, 400, 40, 340, 50, 340, 50, 280, 40, 280, 40, 260, 30, 260, 30, 250, 20, 250, 20, 240, | |
10, 240, 10, 180, 20, 180, 20, 160, 30, 160, 30, 150, 40, 150, 40, 140, 60, 140, 60, 130, | |
50, 130, 50, 20, 60, 20, width=1, fill="black", outline="black") | |
# Cabeza | |
panel.create_polygon(60, 20, 150, 20, 150, 30, 140, 30, 140, 40, 70, 40, 70, 30, 60, 30, width=3, fill="white", | |
outline="white") | |
# Cara | |
panel.create_polygon(60, 40, 70, 40, 70, 50, 140, 50, 140, 40, 150, 40, 150, 130, 140, 130, 140, 140, 70, 140, | |
70, 130, 60, 130, width=1, fill="white", outline="white") | |
# Ojos | |
panel.create_polygon(70, 70, 80, 70, 80, 80, 90, 80, 90, 70, 100, 70, 100, 80, 90, 80, 90, 90, 100, 90, 100, | |
100, | |
90, 100, 90, 90, 80, 90, 80, 100, 70, 100, 70, 90, 80, 90, 80, 80, 70, 80, 70, 70, width=1, | |
fill="black", outline="black") | |
panel.create_polygon(110, 70, 120, 70, 120, 80, 130, 80, 130, 70, 140, 70, 140, 80, 130, 80, 130, 90, 140, 90, | |
140, 100, 130, 100, 130, 90, 120, 90, 120, 100, 110, 100, 110, 90, 120, 90, 120, 80, 110, | |
80, width=1, | |
fill="black", outline="black") | |
# Boca | |
panel.create_polygon(70, 110, 80, 110, 80, 120, 130, 120, 130, 110, 140, 110, 140, 120, 130, 120, 130, 130, 80, | |
130, | |
80, 120, 70, 120, 70, 110, width=1, fill="black", outline="black") | |
# Cuello | |
panel.create_polygon(90, 140, 120, 140, 120, 150, 110, 150, 110, 160, 100, 160, 100, 150, 90, 150, width=1, | |
fill="#FFCC99", outline="#FFCC99") | |
panel.create_polygon(90, 150, 100, 150, 100, 160, 110, 160, 110, 150, 120, 150, 120, 160, 110, 160, 110, 170, | |
100, 170, 100, 160, 90, 160, 90, 150, width=1, fill="gray", outline="gray") | |
# Brazo izquierdo | |
panel.create_polygon(40, 150, 60, 150, 60, 160, 70, 160, 70, 190, 80, 190, 80, 200, 60, 200, 60, 190, | |
50, 190, 50, 210, 40, 210, 40, 220, 60, 220, 60, 210, 70, 210, 70, 240, 60, 240, 60, 250, | |
30, 250, 30, 240, 20, 240, 20, 180, 30, 180, 30, 160, 40, 160, 40, 150, | |
width=1, fill="white", outline="white") | |
# panel.create_line() | |
# Brazo derecho | |
panel.create_polygon(130, 200, 130, 190, 140, 190, 140, 160, 150, 160, 150, 150, 170, 150, 170, 160, 180, 160, | |
180, 180, 190, 180, 190, 240, 180, 240, 180, 250, 150, 250, 150, 240, 140, 240, 140, 200, | |
130, 200, width=1, fill="white", outline="white") | |
panel.create_polygon(140, 200, 150, 200, 150, 190, 160, 190, 160, 210, 170, 210, 170, 220, 150, 220, | |
150, 210, 140, 210, 140, 200, width=1, fill="black", outline="black") | |
# Cuerpo | |
panel.create_polygon(80, 150, 90, 150, 90, 160, 100, 160, 100, 170, 110, 170, 110, 160, 120, 160, 120, 210, | |
110, 210, 110, 230, 120, 230, 120, 240, 140, 240, 140, 250, 150, 250, 150, 290, 60, 290, | |
60, 250, 70, 250, 70, 240, 90, 240, 90, 230, 100, 230, 100, 210, 90, 210, 90, 160, 80, 160, | |
80, 250, width=1, fill="white", outline="white") | |
# Cinturon | |
panel.create_polygon(60, 290, 150, 290, 150, 300, 60, 300, width=1, fill="gray", outline="gray") | |
# Mano izquierda | |
panel.create_polygon(70, 200, 80, 200, 80, 210, 100, 210, 100, 230, 70, 230, 70, 200, width=1, | |
fill="#FFCC99", outline="#FFCC99") | |
# Mano derecha | |
panel.create_polygon(110, 210, 130, 210, 130, 200, 140, 200, 140, 230, 110, 230, 110, 210, width=1, | |
fill="#FFCC99", outline="#FFCC99") | |
# Pierna Izquierda | |
panel.create_polygon(60, 300, 100, 300, 100, 320, 90, 320, 90, 360, 80, 360, 80, 400, 50, 400, 50, 340, 60, 340, | |
60, 300, width=1, fill="white", outline="white") | |
# Pierna Derecha | |
panel.create_polygon(110, 300, 150, 300, 150, 340, 160, 340, 160, 400, 130, 400, 130, 360, 120, 360, 120, 320, | |
110, 320, width=1, fill="white", outline="white") | |
# Pie Izquierdo | |
panel.create_polygon(40, 400, 50, 400, 50, 420, 40, 420, width=1, fill="gray", outline="gray") | |
panel.create_polygon(30, 410, 40, 410, 40, 420, 50, 420, 50, 410, 80, 410, 80, 430, 20, 430, 20, 420, 30, 420, | |
width=1, fill="white", outline="white") | |
panel.create_polygon(60, 410, 70, 410, 70, 420, 60, 420, width=1, fill="gray", outline="gray") | |
# Pie Derecho | |
panel.create_polygon(160, 400, 170, 400, 170, 420, 160, 420, width=1, fill="gray", outline="gray") | |
panel.create_polygon(180, 410, 170, 410, 170, 420, 160, 420, 160, 410, 130, 410, 130, 430, 190, 430, 190, 420, | |
180, 420, width=1, fill="white", outline="white") | |
panel.create_polygon(140, 410, 150, 410, 150, 420, 140, 420, width=1, fill="gray", outline="gray") | |
elif seleccion == 4: | |
panel = Canvas(vs, width=400, height=400, 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") | |
elif seleccion == 5: | |
canvas1 = Canvas(vs, width=600, height=500, 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") | |
elif seleccion == 6: | |
panel = Canvas(vs, width=200, height=200, 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() | |
elif seleccion == 7: | |
panel = Canvas(vs, width=600, height=500, bg="gray") | |
panel.pack() | |
# contorno | |
panel.create_polygon(92, 30, 148, 30, 174, 84, 148, 110, 200, 110, 229, 140, 255, 113, | |
255, 193, 229, 220, 92, 220, 65, 194, 65, 140, 90, 112, 66, 86, 66, 58, width=1, | |
fill="#FFC914") | |
# Alita | |
panel.create_line(120, 140, 120, 166, width=4, fill="#ff9f04") | |
panel.create_line(120, 166, 146, 194, width=4, fill="#ff9f04") | |
panel.create_line(146, 194, 201, 193, width=4, fill="#ff9f04") | |
panel.create_line(201, 193, 227, 166, width=4, fill="#ff9f04") | |
panel.create_line(227, 166, 202, 140, width=4, fill="#ff9f04") | |
panel.create_line(202, 140, 172, 140, width=4, fill="#ff9f04") | |
# Ojito | |
panel.create_oval(94, 72, 106, 86, width=4, fill="black") | |
# Piquito | |
panel.create_polygon(66, 86, 90, 112, 40, 112, width=4, fill="#ff9f04") | |
# Agua | |
panel.create_rectangle(0, 220, 600, 440, width=0, fill="#22d8cf") | |
# Arena | |
panel.create_rectangle(0, 438, 600, 520, width=0, fill="#fffa70") | |
# conchita | |
panel.create_polygon(249, 420, 285, 420, 302, 438, 304, 458, 266, 475, 254, 476, 248, 472, width=2, | |
fill="#ff88c3") | |
panel.create_polygon(266, 475, 254, 476, 266, 482, width=2, fill="#ff88c3") | |
panel.create_polygon(254, 476, 248, 460, 242, 466, width=2, fill="#ff88c3") | |
# cuerpo pescadito | |
panel.create_polygon(31, 290, 42, 302, 60, 308, 74, 318, 88, 333, 88, 348, 73, 348, 45, 333, 43, 330, | |
37, 319, 31, 305, width=2, fill="#2682b4") | |
# aletas pescadito | |
panel.create_polygon(60, 308, 60, 290, 74, 305, 74, 318, width=2, fill="#f98ea9") | |
panel.create_polygon(59, 333, 45, 348, 45, 333, width=2, fill="#f98ea9") | |
panel.create_polygon(37, 319, 29, 319, 15, 305, 31, 305, width=2, fill="#f98ea9") | |
# cola pescadito | |
panel.create_polygon(31, 290, 30, 275, 45, 260, 44, 275, 59, 275, width=2, fill="#f98ea9") | |
elif seleccion == 8: | |
canvas1 = Canvas(vs, width=300, height=300, bg="white") | |
canvas1.pack(expand=YES, fill=BOTH) | |
# contorno | |
canvas1.create_polygon(100, 40, 110, 40, 110, 50, 130, 50, 130, 40, 140, 40, 140, 30, 150, 30, 150, 40, 160, 40, | |
160, 60, 170, 60, 170, 40, 180, 40, 180, 30, 190, 30, 190, 40, 200, 40, 200, 50, 220, 50, | |
220, 40, 230, 40, 230, 50, 240, 50, 240, | |
90, 250, 90, 250, 100, 240, 100, 240, 110, 230, 110, 230, 120, 240, 120, 240, 150, 230, | |
150, 230, 180, 220, 180, 220, 230, 210, | |
230, 210, 220, 200, 220, 200, 200, 190, 200, 190, 220, 200, 220, 200, 230, 190, 230, 190, | |
240, 180, 240, 180, 260, 170, 260, | |
170, 270, 160, 270, 160, 260, 150, 260, 150, 270, 140, 270, 140, 260, 130, 260, 130, 240, | |
120, 240, 120, 230, 110, 230, 110, | |
220, 120, 220, 120, 210, 130, 210, 130, 200, 120, 200, 120, 190, 100, 190, 100, 180, 90, | |
180, 90, 150, 80, 150, 80, 120, 90, | |
120, 90, 110, 80, 110, 80, 100, 70, 100, 70, 90, 80, 90, 80, 80, 90, 80, 90, 50, 100, 50, | |
width=1, fill="black") | |
# naranja | |
canvas1.create_polygon(130, 210, 150, 210, 150, 230, 130, 230, width=1, fill="#FF9B00") | |
canvas1.create_polygon(160, 210, 180, 210, 180, 230, 160, 230, width=1, fill="#FF9B00") | |
canvas1.create_polygon(140, 240, 150, 240, 150, 250, 140, 250, width=1, fill="#FF9B00") | |
canvas1.create_polygon(160, 240, 170, 240, 170, 250, 160, 250, width=1, fill="#FF9B00") | |
# CARNE | |
# pies | |
canvas1.create_polygon(140, 250, 150, 250, 150, 260, 140, 260, width=1, fill="#%02x%02x%02x" % (234, 183, 164)) | |
canvas1.create_polygon(160, 250, 170, 250, 170, 260, 160, 260, width=1, fill="#%02x%02x%02x" % (234, 183, 164)) | |
# manos | |
canvas1.create_polygon(120, 220, 130, 220, 130, 230, 120, 230, width=1, fill="#%02x%02x%02x" % (234, 183, 164)) | |
canvas1.create_polygon(180, 220, 190, 220, 190, 230, 180, 230, width=1, fill="#%02x%02x%02x" % (234, 183, 164)) | |
# cara | |
canvas1.create_polygon(110, 180, 120, 180, 120, 190, 200, 190, 200, 180, 210, 180, 210, 160, 200, 160, 200, 150, | |
120, 150, | |
120, 160, 110, 160, width=1, fill="#%02x%02x%02x" % (234, 183, 164)) | |
# banda | |
canvas1.create_polygon(140, 120, 180, 120, 180, 140, 140, 140, width=1, fill="grey") | |
# ojos | |
canvas1.create_polygon(130, 180, 140, 180, 140, 160, 130, 160, width=1, fill="black") | |
canvas1.create_polygon(130, 160, 140, 160, 140, 150, 130, 150, width=1, fill="blue") | |
canvas1.create_polygon(180, 160, 190, 160, 190, 180, 180, 180, width=1, fill="black") | |
canvas1.create_polygon(180, 160, 190, 160, 190, 150, 180, 150, width=1, fill="blue") | |
# cabello | |
canvas1.create_polygon(100, 180, 110, 180, 110, 160, 120, 160, 120, 150, 100, 150, width=1, | |
fill="#%02x%02x%02x" % (221, 220, 76)) | |
canvas1.create_polygon(220, 180, 210, 180, 210, 160, 200, 160, 200, 150, 220, 150, width=1, | |
fill="#%02x%02x%02x" % (221, 220, 76)) | |
canvas1.create_polygon(100, 140, 100, 130, 110, 130, 110, 120, 120, 120, 120, 110, 200, 110, 200, 120, 210, 120, | |
210, 130, 220, 130, 220, 140, | |
230, 140, 230, 120, 220, 120, 220, 110, 230, 110, 230, 100, 240, 100, 240, 90, 230, 90, | |
230, 50, 220, 50, 220, 60, 210, 60, 210, 70, 200, 70, 200, 50, | |
190, 50, 190, 40, 180, 40, 180, 60, 170, 60, 170, 70, 160, 70, 160, 60, 150, 60, 150, 40, | |
140, 40, 140, 50, 130, 50, 130, 70, 120, 70, 120, 60, 110, 60, | |
110, 50, 100, 50, 100, 90, 80, 90, 80, 100, 90, 100, 90, 110, 100, 110, 100, 120, 90, | |
120, 90, 140, width=1, fill="#%02x%02x%02x" % (221, 220, 76)) | |
elif seleccion == 9: | |
panel = Canvas(vs, width=200, height=200, bg="gray") | |
panel.pack() | |
# cuerpo | |
panel.create_polygon(40, 30, 60, 30, 60, 40, 40, 60, 30, 60, 30, 90, 50, 70, 70, 70, 90, 90, 90, 50, 110, 70, | |
150, 70, 170, 50, 170, 110, 160, 120, 140, 130, 120, 130, 100, 120, 90, 110, 90, 140, 100, | |
140, 100, 160, 70, 160, 70, 120, 50, 120, 40, 130, 40, 140, 60, 140, 60, 160, 20, 160, 0, | |
100, 10, 60, | |
width=10, fill="#e0af77", outline="black") | |
# ojos | |
panel.create_polygon(100, 100, 100, 80, 120, 80, 120, 100, width=1, fill="white", outline="black") | |
panel.create_polygon(140, 80, 140, 100, 160, 100, 160, 80, width=1, fill="white", outline="black") | |
elif seleccion == 10: | |
canvas1 = Canvas(vs, width=700, height=630, 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') | |
elif seleccion == 11: | |
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") | |
elif seleccion == 12: | |
mickey = Canvas(vs, width=390, height=390, bg="light blue") | |
mickey.pack() | |
# oreja | |
mickey.create_polygon(100, 70, 100, 80, 90, 80, 90, 90, 80, 90, 80, 130, 90, 130, 90, 140, 130, 140, 130, 130, | |
140, 130, 140, 90, 130, 90, 130, 80, 120, 80, 120, 70) | |
# cachete izquierdo | |
mickey.create_polygon(120, 140, 120, 150, 110, 150, 110, 200, 120, 200, 120, 210, 130, 210, 130, 220, | |
150, 220, 150, 210, 130, 210, 130, 200, 120, 200, 120, 180, 130, 180, 130, 140) | |
mickey.create_polygon(150, 220, 150, 230, 160, 230, 160, 220) | |
# cara | |
mickey.create_polygon(140, 120, 140, 130, 130, 130, 130, 180, 120, 180, | |
120, 200, 130, 200, 130, 210, 150, 210, 150, 220, 160, 220, | |
160, 230, 210, 230, 210, 220, 220, 220, 220, 210, 240, 210, | |
250, 200, 250, 180, 240, 180, 240, 130, 230, 130, 230, 120, 190, 120, | |
190, 130, 180, 130, 180, 120, width=1, fill="peach puff", outline="black") | |
# frente | |
mickey.create_polygon(130, 110, 230, 110, 230, 120, 130, 120) | |
mickey.create_polygon(170, 100, 200, 100, 200, 110, 170, 110) | |
mickey.create_polygon(180, 120, 190, 120, 190, 130, 180, 130) | |
# mano | |
mickey.create_polygon(130, 230, 130, 250, 140, 250, 140, 240, 150, 240, 150, 230) | |
mickey.create_polygon(110, 220, 110, 230, 90, 230, 90, 250, 100, 250, 100, 260, 130, 260, 130, 250, | |
100, 250, 100, 240, 110, 240, 110, 230, 130, 230, 130, 220, ) | |
mickey.create_polygon(110, 230, 110, 240, 100, 240, 100, 250, 130, 250, 130, 230, width=1, fill="white", | |
outline="black") | |
# oreja derecha | |
mickey.create_polygon(230, 90, 230, 130, 240, 130, 240, 140, 280, 140, 280, 130, 290, 130, 290, 90, 280, 90, | |
280, 80, | |
270, 80, 270, 70, 250, 70, 250, 80, 240, 80, 240, 90) | |
# cachete derecho | |
mickey.create_polygon(240, 140, 240, 180, 250, 180, 250, 200, 240, 200, 240, 210, 250, 210, 250, 200, 260, 200, | |
260, 150, 250, 150, 250, 140) | |
# mano derecha | |
mickey.create_polygon(220, 210, 220, 220, 240, 220, 240, 210) | |
mickey.create_polygon(210, 220, 210, 240, 230, 240, 230, 250, 240, 250, 240, 230, 220, 230, 220, 220) | |
mickey.create_polygon(240, 220, 240, 230, 260, 230, 260, 220) | |
mickey.create_polygon(240, 250, 240, 260, 270, 260, 270, 250, 280, 250, 280, 230, 260, 230, 260, 240, 270, 240, | |
270, 250) | |
mickey.create_polygon(240, 230, 240, 250, 270, 250, 270, 240, 260, 240, 260, 230, width=1, fill="white", | |
outline="black") | |
# cuerpo | |
mickey.create_polygon(140, 280, 140, 260, 150, 260, 150, 230, 210, 230, 210, 240, 160, 240, 160, 260, 150, 260, | |
150, 280) | |
mickey.create_polygon(210, 240, 220, 240, 220, 260, 230, 260, 230, 280, 220, 280, 220, 260, 210, 260, ) | |
# ropa | |
mickey.create_polygon(160, 240, 160, 260, 150, 260, 150, 280, 180, 280, | |
180, 260, 170, 260, 170, 250, 210, 250, 210, 240, width=1, fill="red", outline="black") | |
mickey.create_polygon(190, 250, 180, 250, 180, 270, 190, 270, 190, 280, | |
220, 280, 220, 260, 210, 260, 210, 250, 200, 250, | |
200, 260, 190, 260, width=1, fill="red", outline="red") | |
# botones | |
mickey.create_polygon(170, 250, 170, 260, 180, 260, 180, 250, width=1, fill="yellow", outline="black") | |
mickey.create_polygon(190, 250, 190, 260, 200, 260, 200, 250, width=1, fill="yellow", outline="black") | |
# pies | |
mickey.create_polygon(180, 270, 190, 270, 190, 280, 210, 280, 210, 290, 210, 290, 230, 290, | |
230, 300, 240, 300, 240, 320, 220, 320, 220, 310, 230, 310, 230, 300, 210, 300, | |
210, 290, 200, 290, 200, 300, 190, 300, 190, 280, 180, 280) | |
mickey.create_polygon(180, 300, 180, 320, 150, 320, 150, 330, 180, 330, 180, 320, 190, 320, | |
190, 330, 220, 330, 220, 320, 190, 320, 190, 300) | |
mickey.create_polygon(160, 280, 160, 290, 140, 290, 140, 300, 130, 300, 130, 320, | |
150, 320, 150, 310, 140, 310, 140, 300, 160, 300, 160, 290, 170, 290, | |
170, 300, 180, 300, 180, 280) | |
# zapatos | |
mickey.create_polygon(160, 290, 160, 300, 140, 300, 140, 310, 150, 310, 150, 320, | |
180, 320, 180, 300, 170, 300, 170, 290, width=1, fill="yellow", outline="black") | |
mickey.create_polygon(200, 290, 200, 300, 190, 300, 190, 320, 220, 320, 220, 310, | |
230, 310, 230, 300, 210, 300, 210, 290, width=1, fill="yellow", outline="black") | |
# ojos | |
mickey.create_polygon(150, 160, 150, 180, 160, 180, 160, 160) | |
mickey.create_polygon(210, 160, 210, 180, 220, 180, 220, 160) | |
# nariz | |
mickey.create_polygon(170, 180, 170, 190, 180, 190, 180, 200, 190, 200, 190, 190, | |
200, 190, 200, 180) | |
# boca | |
mickey.create_polygon(160, 200, 160, 210, 170, 210, 170, 220, 200, 220, 200, 210, 210, 210, | |
210, 200, 200, 200, 200, 210, 170, 210, 170, 200) | |
def funcion_main(): | |
vp = Tk() | |
vp.geometry("300x450+5+5") | |
vp.configure(bg="light blue") | |
vp.title("POLIGONOS GRUPO A") | |
boton1 = Button(vp, text="Perrito", bg="red", fg="White", | |
command=lambda: funcion(1, "Programa por Cassandra Gonzalez")) | |
boton1.pack(padx=5, pady=5, fill=X) | |
boton2 = Button(vp, text="ElRichMC", bg="orange", fg="White", | |
command=lambda: funcion(2, "Programa por Victor Hugo Vazquez")) | |
boton2.pack(padx=5, pady=5, fill=X) | |
boton2.pack(padx=5, pady=5, fill=X) | |
boton3 = Button(vp, text="Marshmello", bg="purple", fg="White", | |
command=lambda: funcion(3, "Programa por Brandon Esquivel Rivas")) | |
boton3.pack(padx=5, pady=5, fill=X) | |
boton4 = Button(vp, text="Monito azul", bg="green", fg="White", | |
command=lambda: funcion(4, "Programa por Eduardo Leal")) | |
boton4.pack(padx=5, pady=5, fill=X) | |
boton5 = Button(vp, text="Lobo", bg="blue", fg="White", | |
command=lambda: funcion(5, "Programa por David")) | |
boton5.pack(padx=5, pady=5, fill=X) | |
boton6 = Button(vp, text="Ganso", bg="Purple", fg="White", | |
command=lambda: funcion(6, "Programa por Javier Muñoz")) | |
boton6.pack(padx=5, pady=5, fill=X) | |
boton7 = Button(vp, text="Paisaje", bg="red", fg="White", | |
command=lambda: funcion(7, "Programa por Nicole Rodrguez")) | |
boton7.pack(padx=5, pady=5, fill=X) | |
boton8 = Button(vp, text="Naruto", bg="orange", fg="White", | |
command=lambda: funcion(8, "Programa por Jesus de la Cruz")) | |
boton8.pack(padx=5, pady=5, fill=X) | |
boton9 = Button(vp, text="Gato", bg="purple", fg="White", | |
command=lambda: funcion(9, "Programa por Luis Molina")) | |
boton9.pack(padx=5, pady=5, fill=X) | |
boton10 = Button(vp, text="Astronauta", bg="green", fg="White", | |
command=lambda: funcion(10, "Programa por Alexis Gallegos")) | |
boton10.pack(padx=5, pady=5, fill=X) | |
boton11 = Button(vp, text="Alien", bg="blue", fg="White", | |
command=lambda: funcion(11, "Programa por Kenneth Barragan")) | |
boton11.pack(padx=5, pady=5, fill=X) | |
boton12 = Button(vp, text="Mickey Mouse", bg="purple", fg="White", | |
command=lambda: funcion(12, "Programa por Cynthia Lizeth Barron Morales")) | |
boton12.pack(padx=5, pady=5, fill=X) | |
vp.mainloop() | |
funcion_main() |
Poligono pygame de MORALES ABUNDIS ALEJANDRO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import random | |
AZULNOCHE = (9, 35, 67) | |
VERDEPASTO = (17, 99, 67) | |
VERDE = (10, 255, 10) | |
BLANCO = (222, 224, 200) | |
GRIS = (186, 186, 177) | |
GrisCastillo = (158, 158, 158) | |
NEGRO = (2, 3, 3) | |
ROJO = (255, 0, 0) | |
CAFE = (90, 50, 15) | |
TRUENO = (19, 45, 77) | |
Dimensiones = (500, 500) | |
def dibujar_castillo(pantalla, pos): | |
for x in range(0, 70, 20): | |
pygame.draw.rect(pantalla, GrisCastillo, [290 + x, 220, 10, 10]) | |
pygame.draw.rect(pantalla, NEGRO, [290 + x, 220, 10, 10], 1) | |
pygame.draw.rect(pantalla, GrisCastillo, [250, 200, 40, 105], 0) # pilar iz | |
pygame.draw.rect(pantalla, NEGRO, [250, 200, 40, 105], 2) | |
pygame.draw.rect(pantalla, NEGRO, [262, 210, 16, 16], 0) | |
pygame.draw.rect(pantalla, GrisCastillo, [290, 230, 70, 75], 0)#pilar der | |
pygame.draw.rect(pantalla, NEGRO, [290, 230, 70, 75], 2) | |
pygame.draw.rect(pantalla, GrisCastillo, [360, 200, 40, 105], 0) | |
pygame.draw.rect(pantalla, NEGRO, [360, 200, 40, 105], 2) | |
pygame.draw.rect(pantalla, NEGRO, [372, 210, 16, 16], 0) | |
pygame.draw.polygon(pantalla, NEGRO, [[248, 200], [270, 178], [292, 200]]) | |
pygame.draw.polygon(pantalla, NEGRO, [[358, 200], [380, 178], [402, 200]]) | |
pygame.draw.circle(pantalla, CAFE, [325, 270], 15, 0) | |
pygame.draw.circle(pantalla, NEGRO, [325, 270], 15, 2) | |
pygame.draw.rect(pantalla, CAFE, [310, 270, 30, 30], 0) | |
pygame.draw.rect(pantalla, NEGRO, [310, 270, 30, 30], 1) | |
pygame.draw.circle(pantalla, CAFE, [325, 270], 13, 0) | |
def dibujar_fondo(pantalla): | |
ancho = Dimensiones[0] | |
alto = Dimensiones[1] | |
h1 = Dimensiones[1] / 2 + 50 | |
h2 = Dimensiones[1] / 2 - 50 | |
pygame.draw.rect(pantalla, AZULNOCHE, [0, 0, ancho, h1], 0) | |
pygame.draw.rect(pantalla, VERDEPASTO, [0, h2 + 100, ancho, h2], 0) | |
for y in range(int(h2) + 100, alto, 7): | |
for x in range(0, ancho, 4): | |
pygame.draw.line(pantalla, VERDE, [x, y + 5], [x + 2, y], 1) | |
return h2+100 | |
def dibujar_luna(pantalla, pos): | |
x = pos[0] | |
y = pos[1] | |
pygame.draw.circle(pantalla, BLANCO, pos, 20, 0) # grande | |
pygame.draw.circle(pantalla, GRIS, [x - 10, y - 10], 4, 1) | |
pygame.draw.circle(pantalla, GRIS, [x + 11, y - 1], 3, 1) | |
pygame.draw.circle(pantalla, GRIS, [x - 1, y + 10], 5, 1) | |
def dibujar_lluvia(pantalla, limites, listaPuntos): | |
for i in range(len(listaPuntos)): | |
r = listaPuntos[i][2] | |
x = listaPuntos[i][0] | |
y = listaPuntos[i][1] | |
pygame.draw.circle(pantalla, BLANCO, [x, y], r, 0) | |
listaPuntos[i][1] += 1 | |
if listaPuntos[i][1] > limites[1]: | |
y = random.randrange(-50, -10) | |
listaPuntos[i][1] = y | |
x = random.randrange(50, limites[0]) | |
listaPuntos[i][0] = x | |
def crearPuntosAletorios(cantidad, rangos): | |
listaPuntos = [] | |
for i in range(cantidad): | |
radio = 1 | |
x = random.randrange(1, 390) | |
y = random.randrange(0, 300) | |
listaPuntos.append([x, y, radio]) | |
return listaPuntos | |
def dibujarTexto(pantalla, texto, color): | |
Fuente = pygame.font.Font('AliceandtheWickedMonster.ttf', 25) | |
Texto = Fuente.render(texto, True, color) | |
pantalla.blit(Texto, [250, 10]) | |
def main(): | |
pygame.init() | |
pantalla = pygame.display.set_mode(Dimensiones) | |
pygame.display.set_caption("Dark castle----") | |
game_over = False | |
reloj = pygame.time.Clock() | |
listaPuntos = crearPuntosAletorios(15, [390, 200]) | |
while not game_over: | |
for evento in pygame.event.get(): | |
if evento.type == pygame.QUIT: | |
game_over = True | |
pantalla.fill((255, 255, 255)) | |
#---Fondo------ | |
y_pos = dibujar_fondo(pantalla) | |
#---Luna------- | |
dibujar_luna(pantalla, [25, 25]) | |
#---Luvia------ | |
dibujar_lluvia(pantalla, [390, 300], listaPuntos) | |
#---Castillo--- | |
dibujar_castillo(pantalla, [400, y_pos]) | |
pygame.display.flip() | |
reloj.tick(60) | |
pygame.quit() | |
if __name__ == "__main__": | |
main() |
Django de python (modelo Alumnos)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models | |
# Create your models here. | |
class Datospersonales(models.Model): | |
num_cont= models.CharField(max_length=10, primary_key= True,verbose_name='Numero de Control') | |
nombre = models.CharField(max_length=100) | |
SEXO=(('F','Femenino'),('M','Masculino')) #se hace arreglo | |
Sexo = models.CharField(max_length=1,choices=SEXO,default='M') | |
Edad = models.IntegerField(help_text='Solo mayores de edad') | |
fecha_nacimiento= models.DateField() | |
IS = 'IS' | |
LC = 'LC' | |
LAE = 'LAE' | |
CARRERA_CHOICES = ( | |
('IS','Ing. en Sistemas'), | |
('LC', 'Lic. en Contaduria'), | |
('LAE', 'Lic. en Administracion de Empresas') | |
) | |
Carrera = models.CharField(max_length=30,choices=CARRERA_CHOICES,default=IS, | |
) | |
Telefono = models.CharField(max_length=12) | |
email = models.EmailField() | |
Domicilio= models.TextField() |
martes, 15 de octubre de 2019
perro pygame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pygame | |
import time | |
pygame.init() | |
running = True | |
window = pygame.display.set_mode((1150, 1150)) | |
amarillo=pygame.Color(244,180,0) | |
window.fill((amarillo)) | |
while running: | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
running = False | |
cara=(139, 130, 0) | |
orejas=(139, 130, 85) | |
menton=(255, 78, 0) | |
ojos=(255, 255, 255) | |
nariz=(255, 255, 255) | |
pygame.draw.polygon(window,cara,[(415, 50), (235, 490), (365, 625), (755, 625), (850, 500), (700, 50)],0) | |
# orejas | |
pygame.draw.polygon(window,orejas,[(415, 50), (60, 320), (175, 635)],0) | |
pygame.draw.polygon(window,orejas,[(700, 50), (1045, 320), (896, 635)],0) | |
# menton | |
pygame.draw.polygon(window,menton,[(365, 625), (550, 415), (755, 625)],0) | |
# ojos | |
# pygame.draw.ellipse(window,ojos,[(420, 225), (480, 305)],1 ) | |
#pygame.draw.ellipse(630, 225, 690, 305, width=1, fill="#1a1200", outline="#000000") | |
# bigotes | |
#pygame.draw.ellipse(475, 525, 490, 540, width=1, fill="#1a1200", outline="#000000") | |
#pygame.draw.ellipse(615, 525, 630, 540, width=1, fill="#1a1200", outline="#000000") | |
#pygame.draw.ellipse(445, 560, 460, 575, width=1, fill="#1a1200", outline="#000000") | |
#pygame.draw.ellipse(610, 560, 625, 575, width=1, fill="#1a1200", outline="#000000") | |
#pygame.draw.ellipse(480, 560, 495, 575, width=1, fill="#1a1200", outline="#000000") | |
#pygame.draw.ellipse(640, 560, 655, 575, width=1, fill="#1a1200", outline="#000000") | |
# nariz | |
pygame.draw.line(window, nariz, (50, 50), (75, 75), 4) | |
pygame.draw.line(window, nariz, (75, 75), (25, 25), 4) | |
pygame.draw.line(window, nariz, (25, 25), (50, 50), 4) | |
#pygame.draw.line(window , nariz, (50, 50), (75, 75), 4) | |
#pygame.draw.line(window, nariz, (75, 75), (25, 75), 4) | |
#pygame.draw.line(window, nariz, (25, 75), (50, 50), 4) | |
# pygame.draw.lines(window, (255,255,255), True, ((50, 50), (75, 75), (25, 75)), 1) | |
pygame.display.update() |
Sensor Detector de movimiento con Arduino:
https://www.luisllamas.es/detector-de-movimiento-con-arduino-y-sensor-pir/
****************
https://robologs.net/2018/07/19/como-construir-un-sensor-de-movimiento-con-arduino-y-sensor-pir/
lunes, 14 de octubre de 2019
viernes, 11 de octubre de 2019
miércoles, 9 de octubre de 2019
Poligonos Ejemplos:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
lunes, 7 de octubre de 2019
Aplicacion en Mongo venta Boletos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
import tkMessageBox | |
from tkMessageBox import * | |
from pymongo import MongoClient | |
from Tkinter import OptionMenu | |
from datetime import datetime | |
global total, boletos, area, fecha | |
#VENTANA CON BANNERS | |
ventana = Tk() | |
ventana.title("Venta de Boletos") | |
ventana = Canvas(width = 500, height = 630, bg = 'black') | |
ventana.pack(expand = YES, fill = BOTH) | |
banner1 = PhotoImage(file = 'C:/programas/21p.gif') | |
ventana.create_image(10, 10, image = banner1, anchor = NW) | |
banner2 = PhotoImage(file = 'C:/programas/21pb.gif') | |
ventana.create_image(5, 520, image = banner2, anchor = NW) | |
#AREA A ESCOGER | |
var = StringVar(ventana) | |
var.set("Eliga un area") | |
etiqueta_area = Label(ventana, text='Area: ',background="yellow3",foreground="black",font=('Arial',10)).place(x=120, y=250) | |
ent_area = OptionMenu(ventana, var, "Pista General", "Segundo Piso", "Tercer Piso") | |
ent_area.config(background="yellow3",foreground="black") | |
ent_area.place(x=290, y=250) | |
#CANTIDAD DE BOELTOS | |
et1 = Label(ventana, text="Cantidad de boletos",background="yellow3",foreground="black",font=('Arial',10)).place(x=80, y=320) | |
arr1 = [1, 2, 3, 4, 5, 6, 7] | |
cantidad = StringVar() | |
s1 = Spinbox(ventana, textvariable=cantidad, values=arr1,background="yellow3",foreground="black").place(x=280, y=320) | |
#MOSTRAR MAPA DEL EVENTO | |
def mostrarmapa(): | |
mapa= Toplevel() | |
mapa.title("Mapa del Evento") | |
map = PhotoImage(file='C:/programas/mapa.gif') | |
mostrar = Label(mapa, image=map) | |
mostrar.pack() | |
mapa.mainloop() | |
#CALCULAR TOTAL A PAGAR | |
def comprar(): | |
area = str(var.get()) | |
boletos = int(cantidad.get()) | |
fecha = datetime.now() | |
if area=="Pista General" and boletos<=4: | |
total=boletos*1900 | |
area=1900 | |
tkMessageBox.showinfo("Total", cantidad.get()+" boletos para Pista General, su total es de: " + str(total)) | |
print area | |
print boletos | |
print total | |
print fecha | |
elif area=="Pista General" and boletos>4: | |
showerror("Error", "No se permite adquirir mas de 4 boletos para esta area") | |
elif area=="Segundo Piso" and boletos>0: | |
total = boletos * 1500 | |
area=1500 | |
tkMessageBox.showinfo("Total", cantidad.get()+" boletos para Segundo Piso, su total es de: " + str(total)) | |
print area | |
print boletos | |
print total | |
print fecha | |
elif area=="Tercer Piso" and boletos>0: | |
total = boletos * 1200 | |
area=1200 | |
tkMessageBox.showinfo("Total", cantidad.get()+" boletos para Tercer Piso, su total es de: " + str(total)) | |
print area | |
print boletos | |
print total | |
print fecha | |
conexion(area, boletos, total, fecha) | |
def conexion(area, boletos, total, fecha): | |
client = MongoClient('localhost', 27017) | |
db = client['Boletos'] | |
document = {'Precio de Area': area, 'Cantidad de Boletos': boletos, 'Total a Pagar': total, 'Fecha de Compra': fecha} | |
_id = db['Boletos_Comprados'].insert(document) | |
def infoboletos(): | |
datos = Toplevel(bg = 'black') | |
datos.title("Boletos Vendidos") | |
datos.geometry('520x400') | |
banner = PhotoImage(file='C:/programas/21pb.gif') | |
mostrar = Label(datos, image=banner, background="black") | |
mostrar.place(x=10,y=0) | |
et1 = Label(datos, text="Informacion de Boletos Vendidos", background="yellow3", foreground="black",font=('Arial',19)).place(x=70, y=130) | |
b4 = Button(datos, text='Datos de Boletos Comprados', background="yellow3", foreground="black", command=boletoscomprados,font=('Arial', 10)).place(x=170, y=200) | |
b5 = Button(datos, text='Numero de Boletos Comprados', background="yellow3", foreground="black", command=contarboletoscomprados,font=('Arial', 10)).place(x=160, y=250) | |
b6 = Button(datos, text='Boletos Comprados por Area', background="yellow3", foreground="black",command=boletoscompradosarea, font=('Arial', 10)).place(x=170, y=300) | |
datos.mainloop() | |
def boletoscomprados(): | |
client = MongoClient('localhost', 27017) | |
db = client['Boletos'] | |
coleccion = db['Boletos_Comprados'].find() | |
for x in coleccion: | |
print (x) | |
print " " | |
def contarboletoscomprados(): | |
client = MongoClient('localhost', 27017) | |
db = client['Boletos'] | |
coleccion = db['Boletos_Comprados'] | |
print ('Candtidad de Boeltos Comprados: ', db['Boletos_Comprados'].count_documents({})) | |
print " " | |
def boletoscompradosarea(): | |
client = MongoClient('localhost', 27017) | |
db = client['Boletos'] | |
coleccion = db['Boletos_Comprados'] | |
for datos in coleccion.aggregate([{"$unwind": "$Precio de Area"},{"$group":{"_id":"$Precio de Area","count":{"$sum":1}}}]): | |
print("%s: %d" % (datos["_id"],datos["count"])) | |
print " " | |
#BOTONES | |
b1=Button(ventana, text='Mostrar mapa',background="yellow3",foreground="black", command=mostrarmapa,font=('Arial',10)).place(x=170, y=400) | |
b2=Button(ventana, text='Pagar', background="yellow3",foreground="black", command=comprar,font=('Arial',10)).place(x=275, y=400) | |
b3=Button(ventana, text='Informacion de Boletos Comprados', background="yellow3",foreground="black", command=infoboletos,font=('Arial',10)).place(x=140, y=450) | |
ventana.mainloop() |
Variables en un Entry para que se guarden en Mongo DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
ventana = Tk() | |
ventana.geometry('500x500') | |
ventana.title("Forma de registro") | |
label_0 = Label(ventana, text="forma de registro",width=20,font=("bold", 20)) | |
label_0.place(x=90,y=53) | |
label_1 = Label(ventana, text="Nombre_Completo",width=20,font=("bold", 10)) | |
label_1.place(x=80,y=130) | |
nombre = "" | |
entry = Entry(ventana, width=50, textvariable= nombre) | |
entry.place(x=240,y=130) | |
print(entry.get()) | |
#entry_1 = Entry(ventana) | |
#entry_1.place(x=240,y=130) | |
label_2 = Label(ventana, text="Correo",width=20,font=("bold", 10)) | |
label_2.place(x=68,y=180) | |
entry_2 = Entry(ventana) | |
entry_2.place(x=240,y=180) | |
label_3 = Label(ventana, text="Genero",width=20,font=("bold", 10)) | |
label_3.place(x=70,y=230) | |
var = IntVar() | |
Radiobutton(ventana, text="Hombre",padx = 5, variable=var, value=1).place(x=235,y=230) | |
Radiobutton(ventana, text="mujer",padx = 20, variable=var, value=2).place(x=290,y=230) | |
label_4 = Label(ventana, text="pais",width=20,font=("bold", 10)) | |
label_4.place(x=70,y=280) | |
list1 = ['matamoros','reynosa']; | |
c=StringVar() | |
droplist=OptionMenu(ventana, c, *list1) | |
droplist.config(width=15) | |
c.set('selecciona_tu_pais') | |
droplist.place(x=240,y=280) | |
label_4 = Label(ventana, text="programacion",width=20,font=("bold", 10)) | |
label_4.place(x=85,y=330) | |
var1 = IntVar() | |
Checkbutton(ventana, text="java", variable=var1).place(x=235,y=330) | |
var2 = IntVar() | |
Checkbutton(ventana, text="python", variable=var2).place(x=290,y=330) | |
Button(ventana, text='Submit',width=20,bg='brown',fg='white').place(x=180,y=380) | |
ventana.mainloop() |
Suscribirse a:
Entradas (Atom)