CR EQU 13
LF EQU 10
DATOS SEGMENT
LINEA1 DB CR, LF, 'Armando Hernandez Leal' ,CR, LF, '$'
LINEA2 DB 'Tecnologico de Matamoros' ,CR, LF, '$'
LINEA3 DB 'Ing Sistemas compuntacionales' ,CR, LF, '$'
LINEA4 DB 'SOLTERO' ,CR, LF, '$'
.DATOS ENDS
PILA SEGMENT STACK
DB 64 DUP ( 'PILA' )
PILA ENDS
}CODIGO SEGMENT
LN PROC FAR
ASSUME CS:CODIGO, DS:DATOS, SS:PILA
MOV AX, DATOS
MOV DS, AX
LEA DX, LINEA1
CALL ESCRIBE
LEA DX, LINEA2
CALL ESCRIBE
LEA DX, LINEA3
CALL ESCRIBE
LEA DX, LINEA4
CALL ESCRIBE
MOV AX, 4C00H
INT 21H
LN END P
ESCRIBE PROC
MOV AH, 9
INT 21H
RET
ESCRIBE END P
CODIGO ENDS
END LN
martes, 30 de abril de 2019
Programa 3 -Hola mundo con funcion-
CR EQU 13
LF EQU 10
DATOS SEGMENT
MENSAJE DB CR, LF, 'Hola mundo', CR, LF, '$'
DATOS ENDS
PILA SEGMENT STACK
DB 64 DUP ( 'PILA' )
PILA ENDS
CODIGO SEGMENT
HMF PROC FAR
ASSUME CS:CODIGO, DS:DATPOS, SS:PILA
MOV AX, DATOS
MOV DS, AX
LEA DX, MENSAJE
CALL ESCRIBE
MOV AX, 4C00H
INT 21H
HMF ENDP
ESCRIBE PROC
MOV AH, 9
INT 21H
RET
ESCRIBE ENDP
CODIGO ENDS
END HMF
LF EQU 10
DATOS SEGMENT
MENSAJE DB CR, LF, 'Hola mundo', CR, LF, '$'
DATOS ENDS
PILA SEGMENT STACK
DB 64 DUP ( 'PILA' )
PILA ENDS
CODIGO SEGMENT
HMF PROC FAR
ASSUME CS:CODIGO, DS:DATPOS, SS:PILA
MOV AX, DATOS
MOV DS, AX
LEA DX, MENSAJE
CALL ESCRIBE
MOV AX, 4C00H
INT 21H
HMF ENDP
ESCRIBE PROC
MOV AH, 9
INT 21H
RET
ESCRIBE ENDP
CODIGO ENDS
END HMF
Programa 2 -Uso de Constantes-
CR EQU 13
LF EQU 10
IMPRIMIR EQU 9
FIN EQU 4C00H
DOS EQU 21H
DATOS SEGMENT
TEXTO DB 'EJEMPLO DEL USO DE CONSTANTES' ,CR, LF, 'S'
DATOS ENDS
PILA SEGMENT STACK
DB 64 DUP ( 'PILA' )
PILA ENDS
CODIGO SEGMENT
ASSUME CS:CODIGO, DS:DATOS, SS:PILA
INICIO: MOV AX, DATOS
MOV DS, AX
MOV DX, OFFSET TEXTO
MOV AH, IMPRIMIR
INT DOS
MOV AX, FIN
INT DOS
CODIGO ENDS
END INICIO
LF EQU 10
IMPRIMIR EQU 9
FIN EQU 4C00H
DOS EQU 21H
DATOS SEGMENT
TEXTO DB 'EJEMPLO DEL USO DE CONSTANTES' ,CR, LF, 'S'
DATOS ENDS
PILA SEGMENT STACK
DB 64 DUP ( 'PILA' )
PILA ENDS
CODIGO SEGMENT
ASSUME CS:CODIGO, DS:DATOS, SS:PILA
INICIO: MOV AX, DATOS
MOV DS, AX
MOV DX, OFFSET TEXTO
MOV AH, IMPRIMIR
INT DOS
MOV AX, FIN
INT DOS
CODIGO ENDS
END INICIO
Programa 1 -Hola Mundo-
CR EQU 13
LF EQU 0Ah
DATOS SEGMENT
MENSAJE DB CR, LF, 'Hola mundo'
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
HM END P
CODIGO ENDS
END HM
LF EQU 0Ah
DATOS SEGMENT
MENSAJE DB CR, LF, 'Hola mundo'
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
HM END P
CODIGO ENDS
END HM
U3 - Juego
# -*- coding: utf-8 -*-
import random
import textwrap
if __name__ == '__main__':
seguir_jugando = 1
ocupantes = ['enemigo','amigo','no ocupada']
ancho_linea = 72
linea_punteada = ancho_linea * '-'
print(linea_punteada)
print("\033[1m"+ "Ataca a los Orcos V0.0.1" + "\033[0m")
msg = ("La guerra entre los humanos y sus arqueros enemigos, los Orcos, estaba en el aire."
"Un enorme ejército de orcos se dirigía hacia los territos de los humanos. Destruían"
"prácticamente todo en su camino. Los grandes reyes de la raza humana, se unieron para"
" derrotar a su peor enemigo, era la gran batalla de su tiempo. Sir Gandorel, uno de los "
"valientes caballeros que guardan las llanuras meridionales, inició un largo viaje hacia el este"
", a través de un desconocido bosque espeso. Durante dos días y dos noches, se movió con cautela "
"a través del grueso bosque. En su camino, vio un pequeño asentamiento aislado. Cansado y con "
"la esperanza de reponer su stock de alimentos, decidió tomar un desvío. Cuando se acercó al pueblo,"
"vio cinco chozas. No había nadie alrededor. En ese instante, decidió entrar en un choza...")
print(textwrap.fill(msg, width = ancho_linea))
print("\033[1m"+"Misión:"+"\033[0m")
print("Elige una choza donde poder descansar...")
print("\033[1m"+"NOTA:"+"\033[0m")
print("¡Cuidado! Hay enemigos rondando la zona")
print(linea_punteada)
while seguir_jugando == 1:
chozas = []
while len(chozas) < 5: #Definimos un número de asentamiento para establecerlo como amigo o enemigo
eleccion_aleatoria = random.choice(ocupantes)
chozas.append(eleccion_aleatoria)
msg = "\033[1m" + "Elige una choza, introduce un número entre 1 y 5: " + "\033[0m"
decision_usuario = input("\n"+msg)
idx = int(decision_usuario)
#Pasamos a descubrir cuales son los ocupantes del emplazamiento
print("Descubriendo los ocupantes...")
msg=""
for i in range(len(chozas)):
ocupantes_info = "<%d:%s>"%(i+1, chozas[i])
if i+1 == idx:
ocupantes_info = "\033[1m" + ocupantes_info + "\033[0m"
msg += ocupantes_info + " "
print("\t" + msg)
print(linea_punteada)
print("\033[1m" + "Entrando en la choza %d..." %idx + "\033[0m")
if chozas[idx-1] == 'enemigo':
print("\033[1m" + "Sir Gandorel ha muerto asesinado por una manada de orcos (Mucha suerte la próxima vez)" + "\033[0m")
else:
print("\033[1m" + "¡Felicidades! Sir Gandorel ha podido descansar con éxito" + "\033[0m")
print(linea_punteada)
seguir_jugando = input("¿Quieres jugar de nuevo? Si(1)/No(0):")
import random
import textwrap
if __name__ == '__main__':
seguir_jugando = 1
ocupantes = ['enemigo','amigo','no ocupada']
ancho_linea = 72
linea_punteada = ancho_linea * '-'
print(linea_punteada)
print("\033[1m"+ "Ataca a los Orcos V0.0.1" + "\033[0m")
msg = ("La guerra entre los humanos y sus arqueros enemigos, los Orcos, estaba en el aire."
"Un enorme ejército de orcos se dirigía hacia los territos de los humanos. Destruían"
"prácticamente todo en su camino. Los grandes reyes de la raza humana, se unieron para"
" derrotar a su peor enemigo, era la gran batalla de su tiempo. Sir Gandorel, uno de los "
"valientes caballeros que guardan las llanuras meridionales, inició un largo viaje hacia el este"
", a través de un desconocido bosque espeso. Durante dos días y dos noches, se movió con cautela "
"a través del grueso bosque. En su camino, vio un pequeño asentamiento aislado. Cansado y con "
"la esperanza de reponer su stock de alimentos, decidió tomar un desvío. Cuando se acercó al pueblo,"
"vio cinco chozas. No había nadie alrededor. En ese instante, decidió entrar en un choza...")
print(textwrap.fill(msg, width = ancho_linea))
print("\033[1m"+"Misión:"+"\033[0m")
print("Elige una choza donde poder descansar...")
print("\033[1m"+"NOTA:"+"\033[0m")
print("¡Cuidado! Hay enemigos rondando la zona")
print(linea_punteada)
while seguir_jugando == 1:
chozas = []
while len(chozas) < 5: #Definimos un número de asentamiento para establecerlo como amigo o enemigo
eleccion_aleatoria = random.choice(ocupantes)
chozas.append(eleccion_aleatoria)
msg = "\033[1m" + "Elige una choza, introduce un número entre 1 y 5: " + "\033[0m"
decision_usuario = input("\n"+msg)
idx = int(decision_usuario)
#Pasamos a descubrir cuales son los ocupantes del emplazamiento
print("Descubriendo los ocupantes...")
msg=""
for i in range(len(chozas)):
ocupantes_info = "<%d:%s>"%(i+1, chozas[i])
if i+1 == idx:
ocupantes_info = "\033[1m" + ocupantes_info + "\033[0m"
msg += ocupantes_info + " "
print("\t" + msg)
print(linea_punteada)
print("\033[1m" + "Entrando en la choza %d..." %idx + "\033[0m")
if chozas[idx-1] == 'enemigo':
print("\033[1m" + "Sir Gandorel ha muerto asesinado por una manada de orcos (Mucha suerte la próxima vez)" + "\033[0m")
else:
print("\033[1m" + "¡Felicidades! Sir Gandorel ha podido descansar con éxito" + "\033[0m")
print(linea_punteada)
seguir_jugando = input("¿Quieres jugar de nuevo? Si(1)/No(0):")
lunes, 29 de abril de 2019
U3 - Programa de dialogos (Aportacion)
# Aportacion.- Luis Angel Alonso Rojas
# programa que hace la interfaz
# programa que te pide tus datos basicos
# Luis Angel Alonso Rojas#15260607
from Tkinter import *
root = Tk()
root.title('Formulario 1')
root.geometry("300x100")
root.config(bg="light steel blue")
nombre_label = Label(root, text="Nombre :")
nombre_label.grid(row=1, column=1)
nombre_str = StringVar()
nombre_entry = Entry(root, textvariable=nombre_str)
nombre_entry.grid(row=1, column=2)
last_label = Label(root, text="Apellido : ")
last_label.grid(row=2, column=1)
last_str = StringVar()
last_entry = Entry(root, textvariable=last_str)
last_entry.grid(row=2, column=2)
mail_label = Label(root, text="Email : ")
mail_label.grid(row=3, column=1)
mail_str = StringVar()
mail_entry = Entry(root, textvariable=mail_str)
mail_entry.grid(row=3, column=2)
endfinish = Button(root, text="Finalizar",
relief=FLAT)
endfinish.grid(row=4, column=2)
root.mainloop()
U3 - IMC
import sys
import Tkinter as tk
from Tkinter import *
import tkMessageBox
ventana = Tk()
ventana.title("Tu signo Zodiacal ")
ventana.geometry("400x200")
ventana.config(bg="blue")
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue"
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue")
etiqueta_peso = Label(vp, text='Dame tu peso: ')
etiqueta_peso.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
peso = IntVar()
peso = Entry(vp, width=5, texvariable = peso)
peso.grid(row=1, column=2)
etiqueta_altura = Label(vp, text='Dame tu altura: ')
etiqueta_altura.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
altura = float()
altura = Entry(vp, width = 5, textvariable = altura)
altura.grud(row=1, column=2)
boton = Button(vp, text='Calcular IMC', command=IMC(peso, altura), width=20)
boton.grid(row=5, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ventana.mainloop()
import Tkinter as tk
from Tkinter import *
import tkMessageBox
ventana = Tk()
ventana.title("Tu signo Zodiacal ")
ventana.geometry("400x200")
ventana.config(bg="blue")
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue"
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue")
etiqueta_peso = Label(vp, text='Dame tu peso: ')
etiqueta_peso.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
peso = IntVar()
peso = Entry(vp, width=5, texvariable = peso)
peso.grid(row=1, column=2)
etiqueta_altura = Label(vp, text='Dame tu altura: ')
etiqueta_altura.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
altura = float()
altura = Entry(vp, width = 5, textvariable = altura)
altura.grud(row=1, column=2)
boton = Button(vp, text='Calcular IMC', command=IMC(peso, altura), width=20)
boton.grid(row=5, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ventana.mainloop()
U3 - Programa zodiacal
import sys
import Tkinter as tk
from Tkinter import *
import tkMessageBox
ventana = Tk()
ventana.title("Tu signo Zodiacal ")
ventana.geometry("400x200")
ventana.config(bg="blue")
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue")
var = StringVar(ventana)
ver = StringVar(ventana)
var.set("Enero") # initial valuever = StringVar(ventana)
ver.set("1") # initial value
etiqueta_mes = Label(vp, text='Mes de nacimiento: ')
ent_mes = OptionMenu(vp, var, "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto",
"Septiembre", "Octubre", "Noviembre", "Diciembre", )
etiqueta_mes.grid(row=1, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_mes.grid(row=1, column=3)
etiqueta_dia = Label(vp, text='Fecha de nacimiento: ')
ent_dia = OptionMenu(vp, ver, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
etiqueta_dia.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_dia.grid(row=4, column=3)
def signo():
month = str(var.get())
day = int(ver.get())
if month == "Marzo" and day >= 21 or month == "Abril" and day <= 20:
tkMessageBox.showinfo("Tu eres signo ", " Aries")
elif month == "Abril" and day >= 21 or month == "Mayo" and day <= 21:
tkMessageBox.showinfo("Tu eres signo", " Tauro")
elif month == "Mayo" and day >= 22 or month == "Junio" and day <= 21:
tkMessageBox.showinfo("Tu eres signo", " Gemenis")
elif month == "Junio" and day >= 22 or month == "Julio" and day <= 22:
tkMessageBox.showinfo("Tu eres signo", " Cancer")
if month == "Julio" and day >= 23 or month == "Agosto" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Leo")
if month == "Agosto" and day >= 24 or month == "Septiembre" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Virgo")
if month == "Septiembre" and day >= 24 or month == "Octubre" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Libra")
if month == "Octubre" and day >= 24 or month == "Noviembre" and day <= 22:
tkMessageBox.showinfo("Signo", "Eres Escorpion")
if month == "Noviembre" and day >= 23 or month == "Diciembre" and day <= 21:
tkMessageBox.showinfo("Signo", "Eres Sagitario")
if month == "Diciembre" and day >= 22 or month == "Enero" and day <= 20:
tkMessageBox.showinfo("Signo", "Eres Capricornio")
if month == "Enero" and day >= 21 or month == "Febrero" and day <= 18:
tkMessageBox.showinfo("Signo", "Eres Acuario")
if month == "Febrero" and day >= 19 or month == "Marzo" and day <= 20:
tkMessageBox.showinfo("Signo", "Eres Piscis")
boton = Button(vp, text='Signo', command=signo, width=20)
boton.grid(row=5, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ventana.mainloop()
import Tkinter as tk
from Tkinter import *
import tkMessageBox
ventana = Tk()
ventana.title("Tu signo Zodiacal ")
ventana.geometry("400x200")
ventana.config(bg="blue")
vp = Frame(ventana)
vp.grid(column=0, row=0, padx=(50, 50),
pady=(10, 10)) # para posicionar cualquier objetovp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
vp.config(bg="blue")
var = StringVar(ventana)
ver = StringVar(ventana)
var.set("Enero") # initial valuever = StringVar(ventana)
ver.set("1") # initial value
etiqueta_mes = Label(vp, text='Mes de nacimiento: ')
ent_mes = OptionMenu(vp, var, "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto",
"Septiembre", "Octubre", "Noviembre", "Diciembre", )
etiqueta_mes.grid(row=1, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_mes.grid(row=1, column=3)
etiqueta_dia = Label(vp, text='Fecha de nacimiento: ')
ent_dia = OptionMenu(vp, ver, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
etiqueta_dia.grid(row=4, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ent_dia.grid(row=4, column=3)
def signo():
month = str(var.get())
day = int(ver.get())
if month == "Marzo" and day >= 21 or month == "Abril" and day <= 20:
tkMessageBox.showinfo("Tu eres signo ", " Aries")
elif month == "Abril" and day >= 21 or month == "Mayo" and day <= 21:
tkMessageBox.showinfo("Tu eres signo", " Tauro")
elif month == "Mayo" and day >= 22 or month == "Junio" and day <= 21:
tkMessageBox.showinfo("Tu eres signo", " Gemenis")
elif month == "Junio" and day >= 22 or month == "Julio" and day <= 22:
tkMessageBox.showinfo("Tu eres signo", " Cancer")
if month == "Julio" and day >= 23 or month == "Agosto" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Leo")
if month == "Agosto" and day >= 24 or month == "Septiembre" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Virgo")
if month == "Septiembre" and day >= 24 or month == "Octubre" and day <= 23:
tkMessageBox.showinfo("Tu eres signo", " Libra")
if month == "Octubre" and day >= 24 or month == "Noviembre" and day <= 22:
tkMessageBox.showinfo("Signo", "Eres Escorpion")
if month == "Noviembre" and day >= 23 or month == "Diciembre" and day <= 21:
tkMessageBox.showinfo("Signo", "Eres Sagitario")
if month == "Diciembre" and day >= 22 or month == "Enero" and day <= 20:
tkMessageBox.showinfo("Signo", "Eres Capricornio")
if month == "Enero" and day >= 21 or month == "Febrero" and day <= 18:
tkMessageBox.showinfo("Signo", "Eres Acuario")
if month == "Febrero" and day >= 19 or month == "Marzo" and day <= 20:
tkMessageBox.showinfo("Signo", "Eres Piscis")
boton = Button(vp, text='Signo', command=signo, width=20)
boton.grid(row=5, column=1, padx=(10, 10), pady=(10, 10), sticky=E)
ventana.mainloop()
U3 - Programa punto de venta
from Tkinter import *
import tkMessageBox
def SumMul():
try:
_e0= int(v0.get())
_e0=_e0*.50
_e1 = int(v1.get())
_e1 = _e1 * 1
_e2 = int(v2.get())
_e2 = _e2 * 2
_e3 = int(v3.get())
_e3 = _e3 * 5
_e4 = int(v4.get())
_e4 = _e4 * 10
_e5 = int(v5.get())
_e5 = _e5 * 20
_e6 = int(v6.get())
_e6 = _e6 * 50
_e7 = int(v7.get())
_e7 = _e7 * 100
_e8 = int(v8.get())
_e8 = _e8 * 200
_e9 = int(v9.get())
_e9 = _e9 * 500
_e10= _e0 + _e1 + _e2 + _e3 + _e4 + _e5 + _e6 + _e7 + _e8 + _e9
tkMessageBox.showinfo("El resultado es", _e10)
except ValueError:
tkMessageBox.showerror("Error","Introduce un numero entero")
v=Tk()
v.title("")
v.geometry("300x450")
v.config(bg="black")
vp = Frame(v)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight =1)
ET0=Label(vp,text="MONEDAS",fg="blue",font="ArialBlack")
ET0.grid(column=2, row=1)
e0=Label(vp,text="0.50")
e0.grid(column=1, row=3)
e1=Label(vp,text="1.00")
e1.grid(column=1, row=4)
e2=Label(vp,text="2.00")
e2.grid(column=1, row=5)
e3=Label(vp,text="5.00")
e3.grid(column=1, row=6)
e3=Label(vp,text="10.00")
e3.grid(column=1, row=7)
v0 = ""
v0 = Entry(vp, width=5, textvariable=v0)
v0.grid(row=3, column=2)
v1 = ""
v1 = Entry(vp, width=5, textvariable=v1)
v1.grid(row=4, column=2)
v2 = ""
v2 = Entry(vp, width=5, textvariable=v2)
v2.grid(row=5, column=2)
v3 = ""
v3 = Entry(vp, width=5, textvariable=v3)
v3.grid(row=6, column=2)
v4 = ""
v4 = Entry(vp, width=5, textvariable=v4)
v4.grid(row=7, column=2)
ET1=Label(vp,text="BILLETES",fg="blue",font="Arial")
ET1.grid(column=2, row=9)
e4=Label(vp,text="20.00")
e4.grid(column=1, row=11)
e5=Label(vp,text="50.00")
e5.grid(column=1, row=12)
e6=Label(vp,text="100.00")
e6.grid(column=1, row=13)
e7=Label(vp,text="200.00")
e7.grid(column=1, row=14)
e8=Label(vp,text="500.00")
e8.grid(column=1, row=15)
v5 = ""
v5 = Entry(vp, width=5, textvariable=v5)
v5.grid(row=11, column=2)
v6 = ""
v6 = Entry(vp, width=5, textvariable=v6)
v6.grid(row=12, column=2)
v7 = ""
v7 = Entry(vp, width=5, textvariable=v7)
v7.grid(row=13, column=2)
v8 = ""
v8 = Entry(vp, width=5, textvariable=v8)
v8.grid(row=14, column=2)
v9 = ""
v9 = Entry(vp, width=5, textvariable=v9)
v9.grid(row=15, column=2)
b = Button(vp, text="TOTAL", command=SumMul)
b.grid(row=17, column=2, padx=(20, 20), pady=(20, 20))
b['bg'] = 'blue'
v.mainloop()
import tkMessageBox
def SumMul():
try:
_e0= int(v0.get())
_e0=_e0*.50
_e1 = int(v1.get())
_e1 = _e1 * 1
_e2 = int(v2.get())
_e2 = _e2 * 2
_e3 = int(v3.get())
_e3 = _e3 * 5
_e4 = int(v4.get())
_e4 = _e4 * 10
_e5 = int(v5.get())
_e5 = _e5 * 20
_e6 = int(v6.get())
_e6 = _e6 * 50
_e7 = int(v7.get())
_e7 = _e7 * 100
_e8 = int(v8.get())
_e8 = _e8 * 200
_e9 = int(v9.get())
_e9 = _e9 * 500
_e10= _e0 + _e1 + _e2 + _e3 + _e4 + _e5 + _e6 + _e7 + _e8 + _e9
tkMessageBox.showinfo("El resultado es", _e10)
except ValueError:
tkMessageBox.showerror("Error","Introduce un numero entero")
v=Tk()
v.title("")
v.geometry("300x450")
v.config(bg="black")
vp = Frame(v)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight =1)
ET0=Label(vp,text="MONEDAS",fg="blue",font="ArialBlack")
ET0.grid(column=2, row=1)
e0=Label(vp,text="0.50")
e0.grid(column=1, row=3)
e1=Label(vp,text="1.00")
e1.grid(column=1, row=4)
e2=Label(vp,text="2.00")
e2.grid(column=1, row=5)
e3=Label(vp,text="5.00")
e3.grid(column=1, row=6)
e3=Label(vp,text="10.00")
e3.grid(column=1, row=7)
v0 = ""
v0 = Entry(vp, width=5, textvariable=v0)
v0.grid(row=3, column=2)
v1 = ""
v1 = Entry(vp, width=5, textvariable=v1)
v1.grid(row=4, column=2)
v2 = ""
v2 = Entry(vp, width=5, textvariable=v2)
v2.grid(row=5, column=2)
v3 = ""
v3 = Entry(vp, width=5, textvariable=v3)
v3.grid(row=6, column=2)
v4 = ""
v4 = Entry(vp, width=5, textvariable=v4)
v4.grid(row=7, column=2)
ET1=Label(vp,text="BILLETES",fg="blue",font="Arial")
ET1.grid(column=2, row=9)
e4=Label(vp,text="20.00")
e4.grid(column=1, row=11)
e5=Label(vp,text="50.00")
e5.grid(column=1, row=12)
e6=Label(vp,text="100.00")
e6.grid(column=1, row=13)
e7=Label(vp,text="200.00")
e7.grid(column=1, row=14)
e8=Label(vp,text="500.00")
e8.grid(column=1, row=15)
v5 = ""
v5 = Entry(vp, width=5, textvariable=v5)
v5.grid(row=11, column=2)
v6 = ""
v6 = Entry(vp, width=5, textvariable=v6)
v6.grid(row=12, column=2)
v7 = ""
v7 = Entry(vp, width=5, textvariable=v7)
v7.grid(row=13, column=2)
v8 = ""
v8 = Entry(vp, width=5, textvariable=v8)
v8.grid(row=14, column=2)
v9 = ""
v9 = Entry(vp, width=5, textvariable=v9)
v9.grid(row=15, column=2)
b = Button(vp, text="TOTAL", command=SumMul)
b.grid(row=17, column=2, padx=(20, 20), pady=(20, 20))
b['bg'] = 'blue'
v.mainloop()
U3 - Citculo con coordenadas
from Tkinter import *
def poligono(val1, val2,val3,val4):
v1 = Toplevel(ventana)
v1.title('Grafica')
v1.protocol('WM_DELETE_WINDOW', 'onexit')
v1.geometry('500x500')
grafica = Canvas(v1, width = 300 , height = 300, bg = 'black')
grafica.pack(expand=YES, fill=BOTH)
val1= int(e1.get())
val2= int(e2.get())
val3 = int(e3.get())
val4 = int(e4.get())
grafica.create_oval(val1, val2, val3, val4, fill = 'red')
b = Button(grafica, text = 'Regresar', command = lambda: ejecutar(ocultar(v1)))
b.grid(row = 1, column = 3)
def ocultar(v1):
v1.destroy()
def ejecutar(f):
ventana.after(200, f)
ventana = Tk()
ventana.title('Graficando')
ventana.geometry('700x300')
v1= ''
v2= ''
v3= ''
v4= ''
etiqueta1= Label(ventana, text = 'Valor X1')
etiqueta1.grid(row = 2, column = 1)
etiqueta2= Label(ventana, text = 'Valor Y1')
etiqueta2.grid(row = 3, column = 1)
etiqueta3= Label(ventana, text = 'Valor X2')
etiqueta3.grid(row = 2, column = 3)
etiqueta4= Label(ventana, text = 'Valor Y2')
etiqueta4.grid(row = 3, column = 3)
e1 = Entry(ventana, textvariable = v1)
e1.grid(row = 2, column =2)
e2 = Entry(ventana, textvariable = v2)
e2.grid(row = 3, column = 2)
e3 = Entry(ventana, textvariable = v3)
e3.grid(row = 2, column = 4)
e4 = Entry(ventana, textvariable = v4)
e4.grid(row = 3, column = 4)
b1 = Button(ventana, text = 'Graficar un circulo:', command = lambda:poligono(v1,v2,v3,v4))
b1.grid(row =4, column =2)
b2 = Button(ventana, text = 'Salir', command = lambda: ejecutar(ocultar(ventana)))
b2.grid(row= 4, column = 3)
mainloop()
def poligono(val1, val2,val3,val4):
v1 = Toplevel(ventana)
v1.title('Grafica')
v1.protocol('WM_DELETE_WINDOW', 'onexit')
v1.geometry('500x500')
grafica = Canvas(v1, width = 300 , height = 300, bg = 'black')
grafica.pack(expand=YES, fill=BOTH)
val1= int(e1.get())
val2= int(e2.get())
val3 = int(e3.get())
val4 = int(e4.get())
grafica.create_oval(val1, val2, val3, val4, fill = 'red')
b = Button(grafica, text = 'Regresar', command = lambda: ejecutar(ocultar(v1)))
b.grid(row = 1, column = 3)
def ocultar(v1):
v1.destroy()
def ejecutar(f):
ventana.after(200, f)
ventana = Tk()
ventana.title('Graficando')
ventana.geometry('700x300')
v1= ''
v2= ''
v3= ''
v4= ''
etiqueta1= Label(ventana, text = 'Valor X1')
etiqueta1.grid(row = 2, column = 1)
etiqueta2= Label(ventana, text = 'Valor Y1')
etiqueta2.grid(row = 3, column = 1)
etiqueta3= Label(ventana, text = 'Valor X2')
etiqueta3.grid(row = 2, column = 3)
etiqueta4= Label(ventana, text = 'Valor Y2')
etiqueta4.grid(row = 3, column = 3)
e1 = Entry(ventana, textvariable = v1)
e1.grid(row = 2, column =2)
e2 = Entry(ventana, textvariable = v2)
e2.grid(row = 3, column = 2)
e3 = Entry(ventana, textvariable = v3)
e3.grid(row = 2, column = 4)
e4 = Entry(ventana, textvariable = v4)
e4.grid(row = 3, column = 4)
b1 = Button(ventana, text = 'Graficar un circulo:', command = lambda:poligono(v1,v2,v3,v4))
b1.grid(row =4, column =2)
b2 = Button(ventana, text = 'Salir', command = lambda: ejecutar(ocultar(ventana)))
b2.grid(row= 4, column = 3)
mainloop()
U3 - Boton de color
#!/usr/bin/python
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import *
def Call(): # Definimos la funcion
lab = Label(root, text='Usted presiono\nel boton')
lab.pack()
boton['bg'] = 'blue' # Al presionar queda azul
boton['fg'] = 'white' # Si pasamos el Mouse queda blanco
root = Tk() # Ventana de fondo
root.geometry('100x110+350+70') # Geometría de la ventana
boton = Button(root, text='Presionar', command=Call)
boton.pack()
root.mainloop()
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import *
def Call(): # Definimos la funcion
lab = Label(root, text='Usted presiono\nel boton')
lab.pack()
boton['bg'] = 'blue' # Al presionar queda azul
boton['fg'] = 'white' # Si pasamos el Mouse queda blanco
root = Tk() # Ventana de fondo
root.geometry('100x110+350+70') # Geometría de la ventana
boton = Button(root, text='Presionar', command=Call)
boton.pack()
root.mainloop()
U3 - Listbox con boton
#!/usr/bin/python
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import * # Importamos el modulo Tkinter
def DrawList(): # Creamos una lista con algunos nombres
plist = ['Daniel', 'Jesuss', 'Armando']
for item in plist: # Insertamos los items en un Listbox
listbox.insert(END, item);
root = Tk() # Creamos una ventana de fondo
listbox = Listbox(root)
boton = Button(root, text="Presionar", command=DrawList)
boton.pack()
listbox.pack() # Hacemos los pack() del boton y el Listbox
root.mainloop() # Entramos en el loop
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import * # Importamos el modulo Tkinter
def DrawList(): # Creamos una lista con algunos nombres
plist = ['Daniel', 'Jesuss', 'Armando']
for item in plist: # Insertamos los items en un Listbox
listbox.insert(END, item);
root = Tk() # Creamos una ventana de fondo
listbox = Listbox(root)
boton = Button(root, text="Presionar", command=DrawList)
boton.pack()
listbox.pack() # Hacemos los pack() del boton y el Listbox
root.mainloop() # Entramos en el loop
U3 - Listbox Simple
#!/usr/bin/python
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import * # Importamos el módulo Tkinter
root = Tk() # Creamos la ventana de fondo
# Creamos una lista con nombres
li = 'Daniel Armando Luis Carlos Hector Yisus Nadia Jared'.split()
listb = Listbox(root) # Creamos un Widgets Listbox
for item in li: # Insertamos los nombres de la lista en el Listbox
listb.insert(0, item)
listb.pack() # Hacemos el pack del widget
root.mainloop() # Ejecutamos el bucle
# -*- coding: utf-8 -*-
# www.pythondiario.com
from Tkinter import * # Importamos el módulo Tkinter
root = Tk() # Creamos la ventana de fondo
# Creamos una lista con nombres
li = 'Daniel Armando Luis Carlos Hector Yisus Nadia Jared'.split()
listb = Listbox(root) # Creamos un Widgets Listbox
for item in li: # Insertamos los nombres de la lista en el Listbox
listb.insert(0, item)
listb.pack() # Hacemos el pack del widget
root.mainloop() # Ejecutamos el bucle
U3 - Suma, Resta y Multiplicacion
import sys
from Tkinter import *
def sumar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1+_valor2
etiqueta1.config(text=_valor)
except ValueError:
etiqueta1.config(text="Introduce numeros!")
def restar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1 - _valor2
etiqueta2.config(text=_valor)
except ValueError:
etiqueta2.config(text="Introduce numeros!")
def multiplicar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1 * _valor2
etiqueta3.config(text=_valor)
except ValueError:
etiqueta3.config(text="Introduce numeros!")
app = Tk()
app.title("Operaciones matematicas")
vp = Frame(app)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
etiqueta1 = Label(vp, text="Valor de la suma")
etiqueta1.grid(column=3, row=4, sticky=(W,E))
etiqueta2 = Label(vp, text="Valor de la resta")
etiqueta2.grid(column=5, row=4, sticky=(W, E))
etiqueta3 = Label(vp, text="Valor de la multiplicacion")
etiqueta3.grid(column=7, row=4, sticky=(W, E))
etiqueta4 = Label(vp, text='Dame el primer valor')
etiqueta4.grid(column=1,row=1, sticky=(W, E))
etiqueta5 = Label(vp, text='Dame el segundo valor')
etiqueta5.grid(column=1,row=4, sticky=(W, E))
boton1 = Button(vp, text="Sumar los valores!", command=sumar)
boton1.grid(column=3, row=1)
boton2 = Button(vp, text="Restar los valores!", command=restar)
boton2.grid(column=5, row=1)
boton3 = Button(vp, text="Multiplicar los valores!", command=multiplicar)
boton3.grid(column=7, row=1)
_valor1 = ""
entrada1_texto = Entry(vp, width=10, textvariable=_valor1)
entrada1_texto.grid(column=2, row=1)
valor2 = ""
entrada2_texto = Entry(vp, width=10, textvariable=valor2)
entrada2_texto.grid(column=2, row=4)
vp = Frame(app)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
app.mainloop()
from Tkinter import *
def sumar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1+_valor2
etiqueta1.config(text=_valor)
except ValueError:
etiqueta1.config(text="Introduce numeros!")
def restar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1 - _valor2
etiqueta2.config(text=_valor)
except ValueError:
etiqueta2.config(text="Introduce numeros!")
def multiplicar():
try:
_valor1 = int(entrada1_texto.get())
_valor2 = int(entrada2_texto.get())
_valor = _valor1 * _valor2
etiqueta3.config(text=_valor)
except ValueError:
etiqueta3.config(text="Introduce numeros!")
app = Tk()
app.title("Operaciones matematicas")
vp = Frame(app)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
etiqueta1 = Label(vp, text="Valor de la suma")
etiqueta1.grid(column=3, row=4, sticky=(W,E))
etiqueta2 = Label(vp, text="Valor de la resta")
etiqueta2.grid(column=5, row=4, sticky=(W, E))
etiqueta3 = Label(vp, text="Valor de la multiplicacion")
etiqueta3.grid(column=7, row=4, sticky=(W, E))
etiqueta4 = Label(vp, text='Dame el primer valor')
etiqueta4.grid(column=1,row=1, sticky=(W, E))
etiqueta5 = Label(vp, text='Dame el segundo valor')
etiqueta5.grid(column=1,row=4, sticky=(W, E))
boton1 = Button(vp, text="Sumar los valores!", command=sumar)
boton1.grid(column=3, row=1)
boton2 = Button(vp, text="Restar los valores!", command=restar)
boton2.grid(column=5, row=1)
boton3 = Button(vp, text="Multiplicar los valores!", command=multiplicar)
boton3.grid(column=7, row=1)
_valor1 = ""
entrada1_texto = Entry(vp, width=10, textvariable=_valor1)
entrada1_texto.grid(column=2, row=1)
valor2 = ""
entrada2_texto = Entry(vp, width=10, textvariable=valor2)
entrada2_texto.grid(column=2, row=4)
vp = Frame(app)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
app.mainloop()
U3 - Cajas dialogo multiplicación 5, 10 y 15.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# www.pythondiario.com
import sys
from Tkinter import *
def hacer_click1():
try:
_valor =
int(entrada_texto.get())
_valor = _valor * 5
etiqueta1.config(text=_valor)
except ValueError:
etiqueta1.config(text="Introduce un numero!")
def hacer_click2():
try:
_valor2 =
int(entrada_texto.get())
_valor2 =
_valor2 * 10
etiqueta2.config(text=_valor2)
except ValueError:
etiqueta2.config(text="Introduce un numero!")
def hacer_click3():
try:
_valor =
int(entrada_texto.get())
_valor3 =
_valor * 15
etiqueta3.config(text=_valor3)
except ValueError:
etiqueta1.config(text="Introduce un numero!")
app = Tk()
app.title("Mi segunda App Grafica")
#Ventana Principal
vp = Frame(app)
vp.grid(column=0, row=0, padx=(50,50), pady=(10,10))
vp.columnconfigure(0, weight=1)
vp.rowconfigure(0, weight=1)
etiqueta1 = Label(vp, text="Valor")
etiqueta1.grid(column=2, row=2, sticky=(W,E))
etiqueta2 = Label(vp, text="Valor")
etiqueta2.grid(column=2, row=4, sticky=(W, E))
etiqueta3 = Label(vp, text="Valor")
etiqueta3.grid(column=2, row=6, sticky=(W, E))
boton1 = Button(vp, text="Multiplica por 5!",
command=hacer_click1)
boton1.grid(column=1, row=1)
boton2 = Button(vp, text="Multiplica por 10!",
command=hacer_click2)
boton2.grid(column=1, row=4)
boton3 = Button(vp, text="Multiplica por 15!",
command=hacer_click3)
boton3.grid(column=1, row=7)
valor1 = ""
entrada_texto = Entry(vp, width=10, textvariable=valor1)
entrada_texto.grid(column=2, row=1)
valor2 = ""
entrada_texto = Entry(vp, width=10, textvariable=valor2)
entrada_texto.grid(column=2, row=3)
valor3 = ""
entrada_texto = Entry(vp, width=10, textvariable=valor3)
entrada_texto.grid(column=2, row=5)
app.mainloop()
jueves, 4 de abril de 2019
U2 - Moneda, Billetes
from Tkinter import * import tkMessageBox def SumMul(): try: _e0= int(v0.get()) _e0=_e0*.50 _e1 = int(v1.get()) _e1 = _e1 * 1 _e2 = int(v2.get()) _e2 = _e2 * 2 _e3 = int(v3.get()) _e3 = _e3 * 5 _e4 = int(v4.get()) _e4 = _e4 * 10 _e5 = int(v5.get()) _e5 = _e5 * 20 _e6 = int(v6.get()) _e6 = _e6 * 50 _e7 = int(v7.get()) _e7 = _e7 * 100 _e8 = int(v8.get()) _e8 = _e8 * 200 _e9 = int(v9.get()) _e9 = _e9 * 500 _e10= _e0 + _e1 + _e2 + _e3 + _e4 + _e5 + _e6 + _e7 + _e8 + _e9 tkMessageBox.showinfo("El resultado es", _e10) except ValueError: tkMessageBox.showerror("Error","Introduce un numero entero") v=Tk() v.title("") v.geometry("300x450") v.config(bg="black") vp = Frame(v) vp.grid(column=0, row=0, padx=(50,50), pady=(10,10)) vp.columnconfigure(0, weight=1) vp.rowconfigure(0, weight =1) ET0=Label(vp,text="MONEDAS",fg="blue",font="ArialBlack") ET0.grid(column=2, row=1) e0=Label(vp,text="0.50") e0.grid(column=1, row=3) e1=Label(vp,text="1.00") e1.grid(column=1, row=4) e2=Label(vp,text="2.00") e2.grid(column=1, row=5) e3=Label(vp,text="5.00") e3.grid(column=1, row=6) e3=Label(vp,text="10.00") e3.grid(column=1, row=7) v0 = ""v0 = Entry(vp, width=5, textvariable=v0) v0.grid(row=3, column=2) v1 = ""v1 = Entry(vp, width=5, textvariable=v1) v1.grid(row=4, column=2) v2 = ""v2 = Entry(vp, width=5, textvariable=v2) v2.grid(row=5, column=2) v3 = ""v3 = Entry(vp, width=5, textvariable=v3) v3.grid(row=6, column=2) v4 = ""v4 = Entry(vp, width=5, textvariable=v4) v4.grid(row=7, column=2) ET1=Label(vp,text="BILLETES",fg="blue",font="Arial") ET1.grid(column=2, row=9) e4=Label(vp,text="20.00") e4.grid(column=1, row=11) e5=Label(vp,text="50.00") e5.grid(column=1, row=12) e6=Label(vp,text="100.00") e6.grid(column=1, row=13) e7=Label(vp,text="200.00") e7.grid(column=1, row=14) e8=Label(vp,text="500.00") e8.grid(column=1, row=15) v5 = ""v5 = Entry(vp, width=5, textvariable=v5) v5.grid(row=11, column=2) v6 = ""v6 = Entry(vp, width=5, textvariable=v6) v6.grid(row=12, column=2) v7 = ""v7 = Entry(vp, width=5, textvariable=v7) v7.grid(row=13, column=2) v8 = ""v8 = Entry(vp, width=5, textvariable=v8) v8.grid(row=14, column=2) v9 = ""v9 = Entry(vp, width=5, textvariable=v9) v9.grid(row=15, column=2) b = Button(vp, text="TOTAL", command=SumMul) b.grid(row=17, column=2, padx=(20, 20), pady=(20, 20)) b['bg'] = 'blue' v.mainloop()
U2 - Multiplicacion 2
#!/usr/bin/python# -*- coding: utf-8 -*-# www.pythondiario.com import sys from Tkinter import * def hacer_click1(): try: _valor = int(entrada_texto.get()) _valor = _valor * 5 etiqueta1.config(text=_valor) except ValueError: etiqueta1.config(text="Introduce un numero!") def hacer_click2(): try: _valor2 = int(entrada_texto.get()) _valor2 = _valor2 * 10 etiqueta2.config(text=_valor2) except ValueError: etiqueta2.config(text="Introduce un numero!") def hacer_click3(): try: _valor = int(entrada_texto.get()) _valor3 = _valor * 15 etiqueta3.config(text=_valor3) except ValueError: etiqueta1.config(text="Introduce un numero!") app = Tk() app.title("Mi segunda App Grafica") #Ventana Principalvp = Frame(app) vp.grid(column=0, row=0, padx=(50,50), pady=(10,10)) vp.columnconfigure(0, weight=1) vp.rowconfigure(0, weight=1) etiqueta1 = Label(vp, text="Valor") etiqueta1.grid(column=2, row=2, sticky=(W,E)) etiqueta2 = Label(vp, text="Valor") etiqueta2.grid(column=2, row=4, sticky=(W, E)) etiqueta3 = Label(vp, text="Valor") etiqueta3.grid(column=2, row=6, sticky=(W, E)) boton1 = Button(vp, text="Multiplica por 5!", command=hacer_click1) boton1.grid(column=1, row=1) boton2 = Button(vp, text="Multiplica por 10!", command=hacer_click2) boton2.grid(column=1, row=4) boton3 = Button(vp, text="Multiplica por 15!", command=hacer_click3) boton3.grid(column=1, row=7) valor1 = ""entrada_texto = Entry(vp, width=10, textvariable=valor1) entrada_texto.grid(column=2, row=1) valor2 = ""entrada_texto = Entry(vp, width=10, textvariable=valor2) entrada_texto.grid(column=2, row=3) valor3 = ""entrada_texto = Entry(vp, width=10, textvariable=valor3) entrada_texto.grid(column=2, row=5) app.mainloop()
U2 - Multiplicacion 1
import sys from Tkinter import * def sumar(): try: _valor1 = int(entrada1_texto.get()) _valor2 = int(entrada2_texto.get()) _valor = _valor1+_valor2 etiqueta1.config(text=_valor) except ValueError: etiqueta1.config(text="Introduce numeros!") def restar(): try: _valor1 = int(entrada1_texto.get()) _valor2 = int(entrada2_texto.get()) _valor = _valor1 - _valor2 etiqueta2.config(text=_valor) except ValueError: etiqueta2.config(text="Introduce numeros!") def multiplicar(): try: _valor1 = int(entrada1_texto.get()) _valor2 = int(entrada2_texto.get()) _valor = _valor1 * _valor2 etiqueta3.config(text=_valor) except ValueError: etiqueta3.config(text="Introduce numeros!") app = Tk() app.title("Operaciones matematicas") vp = Frame(app) vp.grid(column=0, row=0, padx=(50,50), pady=(10,10)) vp.columnconfigure(0, weight=1) vp.rowconfigure(0, weight=1) etiqueta1 = Label(vp, text="Valor de la suma") etiqueta1.grid(column=3, row=4, sticky=(W,E)) etiqueta2 = Label(vp, text="Valor de la resta") etiqueta2.grid(column=5, row=4, sticky=(W, E)) etiqueta3 = Label(vp, text="Valor de la multiplicacion") etiqueta3.grid(column=7, row=4, sticky=(W, E)) etiqueta4 = Label(vp, text='Dame el primer valor') etiqueta4.grid(column=1,row=1, sticky=(W, E)) etiqueta5 = Label(vp, text='Dame el segundo valor') etiqueta5.grid(column=1,row=4, sticky=(W, E)) boton1 = Button(vp, text="Sumar los valores!", command=sumar) boton1.grid(column=3, row=1) boton2 = Button(vp, text="Restar los valores!", command=restar) boton2.grid(column=5, row=1) boton3 = Button(vp, text="Multiplicar los valores!", command=multiplicar) boton3.grid(column=7, row=1) _valor1 = ""entrada1_texto = Entry(vp, width=10, textvariable=_valor1) entrada1_texto.grid(column=2, row=1) valor2 = ""entrada2_texto = Entry(vp, width=10, textvariable=valor2) entrada2_texto.grid(column=2, row=4) vp = Frame(app) vp.grid(column=0, row=0, padx=(50,50), pady=(10,10)) vp.columnconfigure(0, weight=1) vp.rowconfigure(0, weight=1) app.mainloop()
U2 - Lista con Boton
#!/usr/bin/python# -*- coding: utf-8 -*-# www.pythondiario.com from Tkinter import * # Importamos el modulo Tkinter def DrawList(): # Creamos una lista con algunos nombres plist = ['Daniel', 'Jesuss', 'Armando'] for item in plist: # Insertamos los items en un Listbox listbox.insert(END, item); root = Tk() # Creamos una ventana de fondo listbox = Listbox(root) boton = Button(root, text="Presionar", command=DrawList) boton.pack() listbox.pack() # Hacemos los pack() del boton y el Listboxroot.mainloop() # Entramos en el loop
U2 - Lista de Compañeros
#!/usr/bin/python# -*- coding: utf-8 -*-# www.pythondiario.com from Tkinter import * # Importamos el módulo Tkinter root = Tk() # Creamos la ventana de fondo# Creamos una lista con nombresli = 'Daniel Armando Luis Carlos Hector Yisus Nadia Jared'.split() listb = Listbox(root) # Creamos un Widgets Listboxfor item in li: # Insertamos los nombres de la lista en el Listbox listb.insert(0, item) listb.pack() # Hacemos el pack del widgetroot.mainloop() # Ejecutamos el bucle
U2 - Graficacion de un Circulo
from Tkinter import * def poligono(val1, val2,val3,val4): v1 = Toplevel(ventana) v1.title('Grafica') v1.protocol('WM_DELETE_WINDOW', 'onexit') v1.geometry('500x500') grafica = Canvas(v1, width = 300 , height = 300, bg = 'black') grafica.pack(expand=YES, fill=BOTH) val1= int(e1.get()) val2= int(e2.get()) val3 = int(e3.get()) val4 = int(e4.get()) grafica.create_oval(val1, val2, val3, val4, fill = 'red') b = Button(grafica, text = 'Regresar', command = lambda: ejecutar(ocultar(v1))) b.grid(row = 1, column = 3) def ocultar(v1):
U2 - Boton Presionar
#!/usr/bin/python# -*- coding: utf-8 -*-# www.pythondiario.com from Tkinter import * def Call(): # Definimos la funcion lab = Label(root, text='Usted presiono\nel boton') lab.pack() boton['bg'] = 'blue' # Al presionar queda azul boton['fg'] = 'white' # Si pasamos el Mouse queda blanco root = Tk() # Ventana de fondoroot.geometry('100x110+350+70') # Geometría de la ventanaboton = Button(root, text='Presionar', command=Call) boton.pack() root.mainloop()
U2 - Poligonos en Clase
rom Tkinter import *
def mostrar(num):
v1 = Toplevel(v0)
v1.title('Ventana hija')
v1.protocol('WM_DELETE_WINDOW', 'onexit')
v1.config(bg='blue')
v1.geometry('800x500')
if num == 1:
hola = Canvas(v1, width=800, height=800, bg='white')
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(300, 300, 400, 200, 500, 200, 600, 300, 700, 200, 800, 200, 900, 300, 878, 395, 600, 700,
325, 401, fill="red", outline="brown", width=6)
b1 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
b1.grid(row=1, column=3)
elif num == 2:
hola = Canvas(v1, width=500, height=500, bg='white')
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(400, 50, 350, 150, 400, 250, 450, 150, fill="red", outline="red", width=6)
hola.create_polygon(400, 250, 300, 250, 250, 350, 350, 350, fill="red", outline="red", width=6)
hola.create_polygon(400, 250, 450, 350, 550, 350, 500, 250, fill="red", outline="red", width=6)
b2 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
b2.grid(row=1, column=3)
elif num == 3:
hola = Canvas(v1, width=300, height=210, bg="black")
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(130, 420, 130, 100, 200, 100, 200, 420,
400, 420, 400, 100, 470, 100, 470, 420,
130, 420, 400, 100, 200, 100, 470, 420,
400, 420, 130, 100, 470, 100, 200, 420,
fill="white")
b3 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b3.grid(row=1, column=3)
elif num == 4:
hola = Canvas(v1, width=500, height=500, bg="skyblue")
hola.pack(expand=YES, fill=BOTH)
# flor
hola.create_polygon(140, 100, 180, 130, 220, 100, 260, 130, 300, 100, 300, 180, 260, 220,
180, 220, 140, 180,
width=2, fill="red", outline="darkred")
# tallo
hola.create_rectangle(215, 220, 225, 410, width=2, fill="forestgreen", outline="darkgreen")
# hojas
hola.create_polygon(80, 250, 170, 260, 215, 320, 140, 310, width=2, fill="forestgreen", outline="darkgreen")
hola.create_polygon(225, 320, 275, 260, 365, 250, 305, 310, width=2, fill="forestgreen", outline="darkgreen")
# maceta
hola.create_polygon(120, 390, 320, 390, 280, 490, 160, 490, width=2, fill="sienna", outline="black")
b4 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b4.grid(row=1, column=3)
elif num == 5:
hola = Canvas(v1, width=550, height=600, bg="BLACK")
hola.pack(expand=YES, fill=BOTH)
# cuerpo pacman
hola.create_arc(80, 200, 180, 300, extent=290, style=PIESLICE, start=40, width=2, fill="YELLOW",
outline="gold")
# ojos
hola.create_arc(120, 215, 145, 240, extent=320, style=PIESLICE, start=220, width=2, fill="black",
outline="white")
# camino
hola.create_rectangle(5, 10, 300, 40, width=5, fill='black', outline="red")
hola.create_rectangle(5, 160, 400, 190, width=5, fill='black', outline="red")
hola.create_rectangle(440, 5, 480, 35, width=5, fill='black', outline="red")
hola.create_rectangle(30, 340, 60, 600, width=5, fill='black', outline="red")
hola.create_rectangle(200, 360, 260, 390, width=5, fill='black', outline="red")
hola.create_rectangle(515, 210, 545, 300, width=5, fill='black', outline="red")
hola.create_polygon(210, 500, 210, 530, 400, 530, 400, 310, 370, 310, 370, 500, width=5, fill="black",
outline="red")
# enemigo fantasma
hola.create_polygon(460, 530, 480, 510, 520, 510, 540, 530, 540, 590, 530, 570, 515, 590,
500, 570, 485, 590, 470, 570, 460, 590, 460, 530, width=3, fill='salmon', outline="pink")
# ojos
hola.create_oval(475, 530, 495, 550, width=2, fill="white", outline="salmon")
hola.create_oval(505, 530, 525, 550, width=2, fill="white", outline="salmon")
# pupila
hola.create_oval(477, 534, 487, 546, width=1, fill="midnightblue", outline="navy")
hola.create_oval(507, 534, 517, 546, width=1, fill="midnightblue", outline="navy")
b5 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b5.grid(row=1, column=3)
elif num == 6:
hola = Canvas(v1, width=700, height=550, bg="black")
hola.pack(expand=YES, fill=BOTH)
# cuerpo coordenadas
hola.create_polygon(100, 100, 420, 100, 500, 180, 500, 220, 460, 260, 460, 400, 500, 430,
500, 460, 460, 460, 420, 420, 420, 340, 380, 300, 340, 340, 340, 460,
260, 460, 260, 340, 260, 460, 180, 460, 180, 340, 180, 460, 140, 460,
140, 340, 140, 460, 80, 460, 40, 340, 40, 200, 20, 280, 13, 280, 35, 195,
width=4, fill="gray", outline="black")
# cuernos forma triangular
hola.create_polygon(350, 275, 445, 298, 350, 298, width=2, fill="white", outline="dimgray")
hola.create_polygon(460, 275, 550, 298, 460, 298, width=2, fill="white", outline="dimgray")
# orejas octagono
hola.create_polygon(260, 100, 300, 100, 340, 140, 340, 220, 300, 260, 260, 260,
220, 220, 220, 140, width=2, fill="gray", outline="dimgray")
hola.create_polygon(460, 140, 500, 100, 540, 100, 580, 140, 580, 220, 540, 260,
500, 260, 470, 250, 500, 220, 500, 180, width=2, fill="gray", outline="dimgray")
# ojos ovalo
hola.create_oval(390, 230, 410, 260, width=1, fill="black", outline="black")
b6 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b6.grid(row=1, column=3)
elif num == 7:
hola = Canvas(v1, width=800, height=800, bg='white')
hola = Canvas(v1, width=210, height=210, bg='pink')
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(382.6, 54.5,
339.07, 56.3,
311.48, 99.02,
284.55, 99.02,
284.78, 141.74,
334.62, 141.74,
336.4, 180.91,
313.26, 212.95,
339.96, 240.54,
338.18, 212.06,
375.56, 254.78,
355, 286,
384.46, 302.84,
454.78, 303.73,
456.56, 210.28,
347.97, 113.26,
340.85, 97.24, fill="white", outline="black", width=6)
b7 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
b7.grid(row=1, column=3)
elif num == 8:
hola = Canvas(v1, width=800, height=800, bg='white')
hola.pack(expand=YES, fill=BOTH)
hola.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="black", outline="lightblue", width=6)
hola.create_polygon(250, 200, 250, 250, 300, 250, 300, 200, fill="white", outline="white", width=6)
hola.create_polygon(500, 200, 450, 200, 450, 250, 500, 250, fill="white", outline="white", width=6)
b8 = Button(hola, text='Ocultar', command=lambda: ejecutar(Ocultar(v1)))
b8.grid(row=1, column=3)
elif num == 9:
hola = Canvas(v1, width=300, height=210, bg="white")
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(100, 150, 300, 450, 500, 150, 380, 150, 380, 120, 360, 120,
360, 150, 310, 150, 310, 90, 290, 90, 290, 150, 240, 150, 240, 120,
220, 120, 220, 150, fill="black")
hola.create_polygon(160, 180, 300, 400, 440, 180, 380, 180, 380, 210,
360, 210, 360, 180, 310, 180, 310, 240, 290, 240,
290, 180, 240, 180, 240, 210, 220, 210, 220, 180, fill="white")
b9 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b9.grid(row=1, column=3)
elif num == 10:
hola = Canvas(v1, width=400, height=400, bg="green")
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(40, 180, 200, 180, 200, 60, 40, 60, width=4, fill="gray", outline="black")
hola.create_polygon(60, 120, 100, 120, 100, 80, 60, 80, width=4, fill="gray", outline="black")
hola.create_polygon(140, 120, 180, 120, 180, 80, 140, 80, width=4, fill="gray", outline="black")
hola.create_polygon(80, 160, 160, 160, 160, 140, 80, 140, width=4, fill="gray", outline="black")
hola.create_polygon(100, 60, 60, 20, width=2, fill="gray", outline="black")
hola.create_polygon(140, 60, 180, 20, width=2, fill="gray", outline="black")
hola.create_polygon(100, 160, 100, 140, width=2, fill="gray", outline="black")
hola.create_polygon(120, 160, 120, 140, width=2, fill="gray", outline="black")
hola.create_polygon(140, 160, 140, 140, width=2, fill="gray", outline="black")
b10 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b10.grid(row=1, column=3)
elif num == 11:
hola = Canvas(v1, width=500, height=500, bg="gray")
hola.pack(expand=YES, fill=BOTH)
hola.create_polygon(202.9761194370994, 459.4555645208418, 302.8134805335928, 460.0196174083926,
312.9664325095075, 421.0999681673856, 334.4004422364383, 414.3313335167757,
367.6795626019361, 442.533977894317, 420.7005340317123, 401.3581171031067,
403.778947405188, 366.3868380749554, 419.0083753690599, 344.3887754604732,
458.4920774976167, 350.0293043359815, 479.9260872245475, 289.1115924804923,
444.9548081963972, 268.2416356411117, 444.4064859562329, 241.8565804562907,
480, 220, 461.2142727412988, 161.3322065712142, 418.3187804621004, 163.5605438324713,
404.948756894558, 142.9484241658429, 422.2183706693002, 108.4091966163574,
370.8458258323626, 68.9289263102584, 338.7634424485586, 97.1272000498291,
316.2701030936517, 89.1210962116416, 307.6853964093092, 47.1347225980438,
199.8879836016924, 47.7688250263239, 199.5709323875523, 115.3007336381564,
214.1552882379946, 107.3744532846549, 227.1543880177367, 104.2039411432543,
238.8852829409185, 103.8868899291143, 249.0309217934001, 106.1062484280947,
260, 100, 271.2245067832035, 97.8629168604532, 283.9065553488056, 98.1799680745932,
295.6374502719874, 101.6675314301339, 304.8319354820488, 105.4721459998146,
320.0503937607712, 113.7154775674561, 328.9278277566926, 121.9588091350976,
335.9029544677737, 133.6897040582798, 338.7564153950341, 142.8841892683415,
339.3905178233142, 148.9081623370026, 347.3167981768155, 148.2740599087225,
355.2430785303167, 151.127520835983, 362.3205776400985, 156.3788148945879,
367.7022882868521, 163.9132098000432, 370.0087357068894, 172.0626573508416,
371.3926041589117, 180.0583417403043, 371.3614620486748, 189.0452306761152,
370.475216735828, 197.1986875543063, 367.4619826721488, 202.338910368818,
376.9014215697061, 208.4847087767439, 389.8245024020653, 210.5803435063157,
401.3504934147099, 209.8817985964584, 409.7330323329969, 205.6905291373148,
413.9243017921403, 216.1687027851738, 417.4170263414266, 235.0294153513201,
418.8141161611411, 255.2872177371808, 416.53312864442, 275.0083869090581,
412.1475561751611, 295.8398561380383, 404.7541868469949, 313.531079988644,
394.9233746041279, 332.0394094660915, 378.3126217551115, 353.4726389486938,
364.0516579708352, 367.9368482289425, 334.8413789422513, 387.0358768245555,
316.8658226169688, 393.0277289329831, 300.3882293187933, 397.1471272575271,
280, 400, 260, 400, 241.5931805048488, 395.6491642304202,
243.0911435319556, 390.0318028787693, 249.4574863971598, 390.0318028787693,
263.3136443978983, 389.2828213652159, 279.4167469392972, 385.5379137974486,
291.0259603993754, 381.4185154729046, 300.76272007557, 376.9246263915839,
309.7504982382113, 373.5542095805934, 319.4872579144059, 366.8133759586123,
331.8454528880375, 360.0725423366313, 340.0842495371253, 352.2082364443201,
344.9526293752226, 342.8459675249019, 347.5740646726597, 329.3643002809397,
335.215869699028, 336.8541154164743, 320.2362394279593, 343.5949490384554,
301.5117015891234, 349.9612919036597, 271.5524410469861, 358.5745793095244,
257.3217922894709, 361.1960146069615, 241.9676712616255, 363.4429591476218,
220.6216981253526, 364.9409221747287,212.0084107194881, 365.3154129315054,
212.0084107194881, 356.327634768864,223.6176241795663, 356.7021255256407,
240.4697082345186, 354.8296717417571,260.3177183436846, 352.2082364443201,
281.2892007231807, 345.8418935791157,277.1698023986369, 341.348004497795,
276.0463301283067, 335.7306431461441,265.9350796953353, 339.1010599571346,
253.202393964927, 343.2204582816786,241.218689748072, 346.5908750926691,
226.6135502337801, 348.8378196333295,212.7573922330415, 348.4633288765528,
212.3829014762648, 343.2204582816786,220, 340,238.2227636938583, 336.1051339029208,
251.7044309378201, 333.109207848707,263.3136443978983, 332.3602263351536,
264.0626259114518, 321.4999943886285,252.4534124513735, 323.7469389292889,
238.2227636938583, 328.2408280106096,220.9961888821293, 331.9857355783768,
212.3829014762648, 334.2326801190372,212.0084107194881, 325.6193927131725,
220.9961888821293, 322.9979574157354,239.7207267209652, 317.3805960640846,
265.9350796953353, 311.3887439556569)
hola.create_polygon(270.0544780198792, 304.2734195768991,277.1698023986369, 297.5325859549181,
268.5565149927723, 297.5325859549181,257.3217922894709, 299.4050397388017,
239.1071354949687, 304.9944241491205,221.3410876172071, 310.9829796135347,
211.7593988741446, 314.5761128921831,211.3601618431836, 304.5951871181596,
261.4644092287812, 290.6218910345265,
255.6754722798476, 284.8329540855929,
239.9056095568906, 285.2321911165538,
212.1586359051055, 286.0306651784757,
211.7593988741446, 277.247450497335,
270.2476239099217, 276.848213466374,
267.6525832086757, 272.4566061258037,
266.6544906312733, 267.6657617542723,
267.6525832086757, 263.2741544137019,
269.8483868789608, 258.6829285576511,
261.4644092287812, 259.481402619573,
248.2895872070703, 260.2798766814949,
238.3086614330469, 261.2779692588973,
228.128117143543, 262.2760618362996,
220.7422320707657, 262.2760618362996,
211.5597803586641, 263.2741544137019,
211.5597803586641, 254.6905582480417,
244.0975983819804, 255.2894137944831,
200.9799990381993, 232.1336659987484,
fill="blue", outline="black", width=2)
hola.create_polygon(252.7838633634599, 250.7204848622283,
246.8157615627554, 249.7258012287775,
237.614937953336, 245.249724878249,
226.6734179853777, 239.0329521691817,
214.488543475606, 231.0754831015756,
199.8169598822074, 217.3985831416275,
195.340883531679, 209.1924431656586,
195.5895544400417, 200.4889613729644,
196.5842380734925, 190.293454130094,
200, 180,
200.8116435156581, 174.6271869032444,
206.2824034996373, 184.3253523293894,
214.9858852923313, 198.4995941060629,
221.2026580013986, 209.689784982384,
234.6308870529837, 230.5781412848502,
243.0856979373151, 239.7789648942698,
249.3024706463823, 245.9957376033371,
fill="blue", outline="black", width=2)
hola.create_polygon(263.865734571309, 252.304090318045,
256.1179110406345, 240.3595290415882,
242.5592198619541, 222.2812741366807,
223.1896610352678, 194.1954138379851,
207.0483620130293, 167.7236834415134,
198.3320605410205, 148.3541246148268,
196.0722786779071, 139.6378231428178,
197.0407566192414, 133.1813035339222,
203.4972762281368, 127.693261866361,
213.9759600976109, 122.1012882139243,
226.2524631835424, 119.6459875967379,
242.7575395546281, 119.5095820068942,
245.4177123269611, 153.3900411275854,
250.4626816485015, 190.9120004565429,
254.2464086396568, 211.7224989078975,
258.3454462134084, 226.2267857073265,
262.5241371143508, 239.6905375342968,
268.3598648365041, 251.2485771138015,
fill="blue", outline="black", width=2)
hola.create_polygon(275.0713774000567, 247.5676293576013,
266.9932794997881, 222.4976703567673,
262.53639789964, 195.199270555859,
261.1436223995937, 175.9789686552196,
260.8650672995844, 149.7947892543485,
261.4221774996029, 114.9754017531901,
282.0352549002882, 114.1397364531622,
305.7124384010753, 119.1537282533291,
317.9688628014827, 127.5103812536071,
325.2112954017235, 137.5383648539407,
329.1110668018532, 146.4521280542372,
319.0830832015198, 151.1875647543948,
309.8907649012142, 158.4299973546358,
300.1413364008901, 169.2936462549972,
294.2916793006956, 179.0430747553216,
290.391907900566, 189.3496134556644,
285.9350263004178, 206.0629194562205,
283.7065855003437, 221.3834499567302,
283.7065855003437, 243.110747757453,
fill="blue", outline="black", width=2)
hola.create_polygon(291.5884636600201, 239.2427776530637,
291.8069435482862, 225.9155044688321,
294.4287022074793, 209.3110329606092,
299.0167798610671, 194.0174407819829,
299.0167798610671, 194.0174407819829,
317.8060502519504, 168.4552938548502,
332.6626826540443, 160.1530581007388,
345.5529960617433, 157.5312994415457,
354.6111686008223, 165.4963226277015,
359.5427205978758, 175.1950415552404,
361.6797264632657, 183.5786799502315,
360.0358757975812, 197.7157956751186,
354.118013401117, 196.400715142571,
349.8440016703373, 195.5787898097287,
336.6931963448612, 195.0856346100233,
327.158862483891, 197.0582554088448,
320, 200,
309.8984304942038, 208.2364399354997,
303.9805680977395, 214.6474575316694,
299.2134011672544, 222.2091705938183,
294.1854388309027, 233.078963816809,
fill="blue", outline="black", width=2)
hola.create_polygon(296.9390377919526, 238.4222151255614,
300.210417992851, 231.7803219904039,
310, 220,
320.5199539711998, 211.0963109028553,
330.2983336575473, 205.8682663180754,
335, 205,
345, 205,
353.1019113154815, 208.7288095766401,
356.3179308098636, 211.0872238725204,
352.2443061169796, 211.0872238725204,
346.5626716769045, 211.0872238725204,
342.703448283646, 212.1592303706478,
339.1658268398256, 214.946447265779,
335.735406045818, 219.3416739081014,
335.1994027967543, 224.1657031496747,
338.5226229409492, 225.7737128968658,
341.6314417855186, 226.6313180953677,
340.7738365870167, 232.3129525354429,
345.3834645289644, 234.2425642320723,
342.5817031876476, 234.234323635067,
344.5348128081197, 236.9392924680085,
344.1988441609097, 240.886924072727,
347.2225619858004, 243.9106418976178,
352.0101152085439, 244.2466105448278,
356.1257311368673, 246.6823832371009,
357.3016214021026, 251.6379207834496,
357.2670624208558, 255.3026595268844,
349.8136249880008, 274.3476995407687,
349.0806501564367, 279.9478187410201,
350.545741801065, 281.5145646089745,
352.6207587856511, 281.3463199886027,
353.3498188072624, 280.2246891861237,
356.3221404338317, 280.1125261058758,
362.8932246239414, 287.162040829641,
363.3196560929043, 290.7156364043316,
361.908716324427, 292.9899251919686,
357.1594061045018, 296.0873014223546,
351.997112387192, 297.6704048289963,
351.7217900556021, 290.1678712931725,
350.6893313121401, 287.001664479889,
348.4179220765238, 285.2808999074524,
340.9842191235975, 284.8679164100676,
336.5102312352623, 283.9042882495031,
331.0726151863625, 280.8069120191171,
332.9310409245941, 278.7419945321931,
342.4296613644443, 278.8108251150906,
344.2192565197784, 277.5718746229362,
344.3569176855733, 274.887481889935,
341.6851396438104, 270.6351879979023,
338.8655066966085, 268.4922669580289,
332.8878848485405, 267.8155550507004,
328.3764721330174, 272.1013971304474,
329.6188832460051, 274.1537251585691,
331.8596093975631, 276.562505771494,
326.5939029414017, 276.7305602328609,
323.0956851898579, 275.0739270951335,
318.9556277994099, 270.9780232943002,
316.2614187361876, 266.8515605387831,
314.0751216507222, 262.2204071144092,
312.226663241625, 255.1345619987713,
312.27627775426, 245.8399686803374,
312.3496735873269, 241.876593694725,
319.7626527270835, 231.8213645645602,
320.5700068908194, 228.5919479096167,
318.8085068972139, 225.7295104200078,
315.6524860753373, 223.7478229272016,
311.0285485921228, 224.5551770909375,
306.7715902742428, 227.3442187474795,
298.037486139282, 237.0324687123098,
fill="blue", outline="black", width=2)
hola.create_polygon(300.0617375788183, 244.2929670499564,
306.3278631364796, 250.0369154778124,
306.3858828175691, 242.2622782118254,
307.7203354826266, 237.8527824490268,
311.3755753912624, 231.876755296813,
309.3448865531313, 232.4569521077075,
305.2835088768694, 236.9244675515956,
301.802328011502, 241.3919829954836,
300.5258950275339, 243.4226718336146,
fill="blue", outline="black", width=2)
hola.create_polygon(350.2661249469691, 346.7894284219767,
355.0583499545213, 337.033827513746,
357.6256133514242, 325.7378685673735,
357.4544624582973, 317.6937765904113,
357.2833115651705, 311.1900426515908,
355.0583499545213, 305.028610499024,
366.1831580077673, 300.7498381708526,
378.3348714197745, 294.5884060182858,
385.5232089311027, 288.7692756519727,
389.973132152401, 283.2924470719134,
391.1711884042891, 276.617562239966,
391.6846410836696, 272.6810916980484,
387.9193214348787, 265.6639050798473,
396.4768660912218, 270.6272809805261,
400, 280,
401.097940205647, 291.8499917282562,
396.8191678774755, 306.9112703234194,
392.1980937630502, 318.036078376665,
385.3520580379758, 327.2782266055152,
377.8214187403939, 334.1242623305894,
368.5792705115434, 339.9433926969025,
355.0583499545213, 345.9336739563424,
fill="blue", outline="black", width=2)
hola.create_polygon(319.4283345656475, 332.1120026243448,
319.4283345656475, 324.8933647631799,
317.2072152237506, 318.4151000159805,
314.2457227678879, 313.7877680536952,
307.3972714637055, 309.9008092053757,
317.5774017807333, 309.5306226483928,
329.9786514396582, 311.3815554333069,
338.8631288072461, 314.1579546106781,
346.6370465038856, 318.7852865729633,
322.0196404645274, 331.0014429533963,
fill="blue", outline="black", width=2)
hola.create_polygon(344.4642814864766, 296.5520153997359,
344.5965257974588, 301.8417878390208,
347.7703892610298, 309.1152249430376,
340.8936850899591, 305.4123842355381,
332.1655605651387, 303.0319866378599,
311.4032037409447, 303.2964752598241,
298.9401678526973, 303.2616271794951,
290.628911835822, 305.4487998155149,
282.9009018552185, 309.8231450875544,
278.2349335650429, 315.2181709230698,
274.2980228202072, 323.0919924127409,
274.2980228202072, 317.4053435590895,
276.922629983431, 310.6980141419623,
280.1304831829268, 305.4487998155149,
287.8584931635302, 297.7207898349117,
295.8781261622696, 300.6370200162714,
305.5016857607568, 301.2202660525433,
315.2710568683121, 301.2202660525433,
325.7694855212073, 301.0744545434753,
334.8097990834226, 299.0330934165236,
341.954563027754, 297.2833553077078,
fill="blue", outline="black", width=2)
hola.create_polygon(279.7097805171387, 287.6379579767697,
290.2790474814249, 293.6599821773514,
307.3619324585854, 295.9950527857401,
322.3555437335032, 294.520271348863,
338.8239364452982, 291.3249115689625,
332.4332168854971, 290.0959270382316,
321.4952545619915, 285.6715827276002,
316.0877226267752, 281.7388322292612,
312.0320736753631, 275.3481126694602,
308.7138154423894, 281.3701368700419,
301.831502070296, 287.6379579767697,
292.85991499596, 289.7272316790123,
284.5028201869894, 288.8669425075007,
fill="blue", outline="black", width=2)
b11 = Button(hola, text='ocultar', command=lambda: ejecutar(Ocultar(v1)))
b11.grid(row=12, column=6)
def Ocultar(ventana):
ventana.destroy()
def ejecutar(f):
v0.after(200, f)
v0 = Tk() # Este es mi objeto ventana
v0.title('Ventana Madre')
v0.config(bg='black')
v0.geometry('500x500')
b1 = Button(v0, text='Figura Daniel Luna', command=lambda: ejecutar(mostrar(1)))
b1.grid(row=1, column=10)
b2 = Button(v0, text='Figura Luis Rincon', command=lambda: ejecutar(mostrar(2)))
b2.grid(row=4, column=10)
b3 = Button(v0, text='Figura Nadia Rodriguez', command=lambda: ejecutar(mostrar(3)))
b3.grid(row=6, column=10)
b4 = Button(v0, text='Figura Wendy Lopez', command=lambda: ejecutar(mostrar(4)))
b4.grid(row=8, column=10)
b5 = Button(v0, text='Figura Wendy Lopez2', command=lambda: ejecutar(mostrar(5)))
b5.grid(row=10, column=10)
b6 = Button(v0, text='Figura Wendy Lopez3', command=lambda: ejecutar(mostrar(6)))
b6.grid(row=12, column=10)
b7 = Button(v0, text='Figura Gustavo Vazquez', command=lambda: ejecutar(mostrar(7)))
b7.grid(row=14, column=10)
b8 = Button(v0, text='Figura Hector Campos', command=lambda: ejecutar(mostrar(8)))
b8.grid(row=16, column=10)
b9 = Button(v0, text='Figura Jesuss Escobar', command=lambda: ejecutar(mostrar(9)))
b9.grid(row=18, column=10)
b10 = Button(v0, text='Figura Armando Hernandez', command=lambda: ejecutar(mostrar(10)))
b10.grid(row=20, column=10)
b11 = Button(v0, text='Figura Jared Garcia', command=lambda: ejecutar(mostrar(11)))
b11.grid(row=22, column=10)
v0 = mainloop()
Suscribirse a:
Comentarios (Atom)
Unidad 3 - Configuracion y Administracion del Espacio en Disco
3.1 Estructuras logicas de almacenamiento. Para la gestión del almacenamiento de una base de datos existen 4 conceptos bien definidos que ...
-
3.1 Estructuras logicas de almacenamiento. Para la gestión del almacenamiento de una base de datos existen 4 conceptos bien definidos que ...
-
import sys from Tkinter import * def sumar(): try : _valor1 = int (entrada1_texto.get()) _valor2 = int (entrada2_texto.get()) _valor...
-
USO DE LA LIBERIA emu8086 emu8086.inc define las siguientes macros : PRINT string - macro con 1 parámetro, imprime una cadena.PRINT...



