|
# -*- coding: utf-8 -*- |
|
from Tkinter import * |
|
import Tkinter as tk |
|
import tkMessageBox |
|
import time |
|
|
|
|
|
|
|
raiz = Tk() |
|
raiz.geometry('550x320+0+0') |
|
raiz.title("Pago de Servicios") |
|
raiz.resizable(1,1) |
|
raiz.config(bg="dark turquoise") |
|
miFrame = Frame(raiz) |
|
miFrame.config(bg="dark turquoise") |
|
miFrame.pack() |
|
variable=IntVar() |
|
|
|
def calculo(): |
|
pagox = 0 |
|
pre = precio.get() |
|
can = cantidad.get() |
|
|
|
pagox = pre * can |
|
|
|
return pagox |
|
|
|
def formapago(): |
|
iva=0 |
|
s=variable.get() |
|
if s==1: |
|
iva=0 |
|
return iva |
|
elif s==2: |
|
iva=(0.15*calculo()) |
|
return iva |
|
elif s==3: |
|
iva=0 |
|
return iva |
|
def servicio(): |
|
ser=var1.get() |
|
ser1="" |
|
if ser=="Luz": |
|
ser1+="Luz" |
|
return ser1 |
|
elif ser == "Agua": |
|
ser1+="Agua" |
|
return ser1 |
|
elif ser=="Gas": |
|
ser1+="Gas" |
|
return ser1 |
|
|
|
def calcularp(): |
|
total=calculo()+formapago() |
|
ivat=formapago() |
|
|
|
ventanaIngresar = Tk() |
|
ventanaIngresar.geometry("350x300") |
|
ventanaIngresar.title("Ticket de Pago") |
|
|
|
labelv2=Label(ventanaIngresar,text="Tipo de Servicio a pagar.......................................... ").place(x=30,y=30) |
|
labelv21 = Label(ventanaIngresar, text="Cantidad a pagar sin IVA........................................ $").place(x=30, y=60) |
|
labelv22 = Label(ventanaIngresar, text="IVA............................................................................. $").place(x=30, y=90) |
|
labelv23 = Label(ventanaIngresar, text="Total a pagar............................................................. $").place(x=30, y=120) |
|
labelv24 = Label(ventanaIngresar, text="Gracias por su preferencia\nVuelva pronto :D").place(x=100, y=250) |
|
labelv25 = Label(ventanaIngresar, text=servicio()).place(x=300, y=30) |
|
labelv25 = Label(ventanaIngresar, text=calculo()).place(x=300, y=60) |
|
labelv26 = Label(ventanaIngresar, text=ivat).place(x=300, y=90) |
|
labelv26 = Label(ventanaIngresar, text=total).place(x=300, y=120) |
|
labelv27 = Label(ventanaIngresar, text=time.strftime("%I:%M:%S")).place(x=150, y=200) |
|
labelv28=Label(ventanaIngresar,text=time.strftime("%d/%m/%y")).place(x=150,y=220) |
|
|
|
|
|
ventanaIngresar.mainloop() |
|
|
|
def etiquetas(): |
|
|
|
op=var1.get() |
|
if op=="Luz": |
|
label2 = Label(text="Precio por Kilowats ", bg="grey").place(x=10, y=35) |
|
label3=Label (text="Consumo de Kilowats ",bg="grey").place(x=200,y=35) |
|
elif op=="Agua": |
|
label4 = Label(text="Precio de Agua(metro cubico)", bg="grey").place(x=10, y=35) |
|
label5 = Label(text="Consumo de Agua ", bg="grey").place(x=200, y=35) |
|
elif op=="Gas": |
|
label6 = Label(text="Precio del Gas ", bg="grey").place(x=10, y=35) |
|
label7 = Label(text="Consumo del Gas", bg="grey").place(x=200, y=35) |
|
|
|
|
|
#creando Labels |
|
label1=Label (text="Selecciona el Servicio\n que deseas ", bg="grey").place(x=390,y=20) |
|
label8=Label (text="Selecciona su forma de pago ",bg="grey").place(x=30,y=150) |
|
|
|
#Creando RadioButton |
|
rb1=Radiobutton(text="Efectivo",bg="yellow", variable=variable,value=1,command=formapago()).place(x=50,y=180) |
|
rb2=Radiobutton(text="Tarjeta de Credito",bg="yellow", variable=variable,value=2,command=formapago()).place(x=50,y=210) |
|
rb3=Radiobutton(text="Tarjeta de Debito", bg="yellow",variable=variable,value=3,command=formapago()).place(x=50,y=240) |
|
|
|
#Entry |
|
precio= tk.IntVar(miFrame) |
|
precio.set(0) |
|
cantidad= tk.IntVar(miFrame) |
|
cantidad.set(0) |
|
|
|
|
|
txt1 = Entry(textvariable=precio) |
|
txt1.place(x=10, y=70) |
|
txt1.config(fg="blue", justify="center") |
|
|
|
txt2 = Entry(textvariable=cantidad) |
|
txt2.place(x=200, y=70) |
|
txt2.config(fg="blue", justify="center") |
|
|
|
|
|
# Lista de opciones desplegable |
|
var1 = tk.StringVar(miFrame) |
|
var1.set("Servicios") |
|
opciones = ["Luz", "Agua", "Gas"] |
|
opcion = tk.OptionMenu(miFrame,var1, *opciones) |
|
opcion.config(width=20,bg="yellow") |
|
opcion.grid(row=0, column=3,padx=370,pady=70) |
|
#opcion.pack(side='left',padx=50,pady=260) |
|
|
|
#Button |
|
pagar= Button( text="Calcular Recibo", bg="green",command=calcularp).place(x=420,y=240) |
|
selection= Button( text="Seleccionar", bg="yellow",command=etiquetas).place(x=420,y=130) |
|
|
|
|
|
raiz.mainloop() |
Comentarios
Publicar un comentario