Está en la página 1de 4

from tkinter import *

ventana = Tk()
ventana.title("Ferretería El tornillo feliz")
ventana.config(bg= "lightblue")
ventana.resizable(width=True,height=True)

cuadro = Frame(ventana,width=1000, height=1000)


cuadro.pack()

label_titulo = Label(cuadro, text="Ferretria El tornillo Feliz", font=("Comic Sans


MS", 18))
label_titulo.grid(row=0, column=2, pady=10, padx=10)

label_dni = Label(cuadro, text="DNI")


label_dni.grid(row=1, column=0, padx=5,pady=5)
cuadro_dni = Entry(cuadro,width=15)
cuadro_dni.grid(row=1, column=1, columnspan=2,sticky="w", padx=5,pady=5)

label_apellido = Label(cuadro, text="Apellidos")


label_apellido.grid(row=2, column=0, padx=5,pady=5)
cuadro_apellido = Entry(cuadro,width=20)
cuadro_apellido.grid(row=2, column=1,columnspan=4, sticky="w", padx=5,pady=5)

label_nombre = Label(cuadro, text="Nombres").place(x=282,y=88)


cuadro_nombre = Entry(cuadro,width=20)
cuadro_nombre.grid(row=2, column=4,columnspan=4,sticky="w", padx=5,pady=5)

label_direccion =Label(cuadro, text="Dirección")


label_direccion.grid(row=3, column=0, padx=5,pady=5)
cuadro_direccion = Entry(cuadro, width=52)
cuadro_direccion.grid(row=3, column=1, columnspan=4, sticky="w", padx=5,pady=5)

label_telefono =Label(cuadro, text="Teléfono")


label_telefono.grid(row=4, column=0, padx=5,pady=5)
cuadro_telefono = Entry(cuadro, width=52)
cuadro_telefono.grid(row=4, column=1, columnspan=4 , sticky="w", padx=5,pady=5)

def Total():

try:

c=int(Cantidad.get());
c1=int(Cantidad1.get());
c2=int(Cantidad2.get());
p=float(Precio.get());
p1=float(Precio1.get());
p2=float(Precio2.get());

su=(c*p);
su1=(c1*p1);
su2=(c2*p2);

totall = (su+su1+su2);

Subtotal.set(str(su));
Subtotal1.set(str(su1));
Subtotal2.set(str(su2));

This study source was downloaded by 100000867250967 from CourseHero.com on 05-15-2023 13:41:16 GMT -05:00

https://www.coursehero.com/file/142848649/Trabajo-Tornillo-
Total1.set(str(totall));
except ValueError:
MessageBox.showinfo("No funciona");

def Codigos():
try:
codg=int(Codigo.get());
codg1=int(Codigo1.get());
codg2=int(Codigo2.get());
desc=Descripcion.get();
desc1=Descripcion1.get();
desc2=Descripcion2.get();

prec=Precio.get();
prec1=Precio1.get();
prec2=Precio2.get();

uni=Unidad.get();
uni1=Unidad1.get();
uni2=Unidad2.get();

if codg>0 and codg<10:


desc="Martillo"
prec=50
uni = "Kilos"
elif codg>9 and codg <20:
desc="Alicate"
prec=70
uni= "Kilos"
else:
desc= "Destornillador"
prec=12
uni ="Gramos"

if codg1>0 and codg1<10:


desc1="Martillo"
prec1=50
uni1 = "Kilos"
elif codg1>9 and codg1<20:
desc1="Alicate"
prec1= 70
uni1= "Kilos"
else:
desc1= "Destornillador"
prec1=12
uni1 ="Gramos"

if codg2>0 and codg2<10:


desc2="Martillo"
prec2=50
uni2 ="Kilos"
elif codg2>9 and codg2<20:
desc2="Alicate"
prec2=70
uni2="Kilos"
else:
desc2= "Destornillador"
prec2=12

This study source was downloaded by 100000867250967 from CourseHero.com on 05-15-2023 13:41:16 GMT -05:00

https://www.coursehero.com/file/142848649/Trabajo-Tornillo-
uni2= "Gramos"

Precio.set(str(prec));
Precio1.set(str(prec1));
Precio2.set(str(prec2));

Descripcion.set(str(desc));
Descripcion1.set(str(desc1));
Descripcion2.set(str(desc2));

Codigo.set(str(codg));
Codigo1.set(str(codg1));
Codigo2.set(str(codg2));

Unidad.set(str(uni));
Unidad1.set(str(uni1));
Unidad2.set(str(uni2));
except ValueError:
MessageBox.showinfo("No funciona");

Codigo = StringVar()
Codigo1 = StringVar()
Codigo2 = StringVar()

label_codigoproducto = Label(cuadro, text="Cod_Prod").place(x=10,y=183)


cuadro_Codigoproducto1 = Entry(cuadro, width=9, textvariable
=Codigo).place(x=10,y=214)
cuadro_Codigoproducto2 = Entry(cuadro, width=9,textvariable
=Codigo1).place(x=10,y=244)
cuadro_Codigoproducto3 = Entry(cuadro, width=9,textvariable
=Codigo2).place(x=10,y=274)

Descripcion = StringVar()
Descripcion1 =StringVar()
Descripcion2 =StringVar()

label_descripcion = Label(cuadro, text="Descripción").place(x=90,y=183)


cuadro_descripcion1 = Entry(cuadro, width=13,textvariable =
Descripcion).place(x=90,y=214)
cuadro_descripcion2 = Entry(cuadro, width=13,textvariable =
Descripcion1).place(x=90,y=244)
cuadro_descripcion3 = Entry(cuadro, width=13,textvariable =
Descripcion2).place(x=90,y=274)

Unidad = StringVar()
Unidad1 = StringVar()
Unidad2 = StringVar()

label_unidad = Label(cuadro, text="Unidad").place(x=185,y=183)


cuadro_unidad1 = Entry(cuadro, width=9, textvariable = Unidad).place(x=182,y=214)
cuadro_unidad2 = Entry(cuadro, width=9,textvariable = Unidad1).place(x=182,y=244)
cuadro_unidad3 = Entry(cuadro, width=9,textvariable = Unidad2).place(x=182,y=274)

Cantidad = StringVar()
Cantidad1 = StringVar()
Cantidad2 = StringVar()

label_cantidad = Label(cuadro, text="Cantidad").place(x=260,y=183)

This study source was downloaded by 100000867250967 from CourseHero.com on 05-15-2023 13:41:16 GMT -05:00

https://www.coursehero.com/file/142848649/Trabajo-Tornillo-
cuadro_Cantidad1 = Entry(cuadro, width=9, textvariable =
Cantidad).place(x=258,y=214)
cuadro_Cantidad2 = Entry(cuadro, width=9, textvariable =
Cantidad1).place(x=258,y=244)
cuadro_Cantidad3 = Entry(cuadro, width=9, textvariable =
Cantidad2).place(x=258,y=274)

Precio = StringVar()
Precio1 = StringVar()
Precio2 = StringVar()

label_precio = Label(cuadro, text="Precio").place(x=340,y=183)


cuadro_Precio1 = Entry(cuadro, width=9,textvariable = Precio).place(x=330,y=214)
cuadro_Precio2 = Entry(cuadro, width=9,textvariable = Precio1).place(x=330,y=244)
cuadro_Precio3 = Entry(cuadro, width=9,textvariable = Precio2).place(x=330,y=274)

Subtotal = StringVar()
Subtotal1 = StringVar()
Subtotal2 = StringVar()

label_Subtotal = Label(cuadro, text="Subtotal")


label_Subtotal.grid(row=5, column=5, pady=5, padx=5)
cuadro_Subtotal1 = Entry(cuadro, width=9,textvariable = Subtotal)
cuadro_Subtotal1.grid(row=6, column=5, pady=5, padx=5)
cuadro_Subtotal2 = Entry(cuadro, width=9,textvariable = Subtotal1)
cuadro_Subtotal2.grid(row=7, column=5, pady=5, padx=5)
cuadro_Subtotal3 = Entry(cuadro, width=9,textvariable = Subtotal2)
cuadro_Subtotal3.grid(row=8, column=5, pady=5, padx=5)

Total1 = StringVar()

label_total = Button(cuadro, text="Total", command=Total).place(x=350,y=300)


label_total = Entry(cuadro, width=9, textvariable = Total1).place(x=400,y=300)

boton = Button(cuadro, text="Descrip_Precio", command=Codigos)


boton.grid(row=10, column=0, pady=5, padx=5)

ventana.mainloop()

This study source was downloaded by 100000867250967 from CourseHero.com on 05-15-2023 13:41:16 GMT -05:00

https://www.coursehero.com/file/142848649/Trabajo-Tornillo-

También podría gustarte