Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """ Programa que implementa una calculadora de sumas con pantalla"""
- import tkinter as tk
- ventana = tk.Tk()
- ventana.config(width=400, height=300)
- ventana.title("Sumador")
- def sumar():
- suma_total = float(caja_A.get()) + float(caja_B.get())
- total.set(str(suma_total))
- total = tk.StringVar()
- total.set("0")
- boton = tk.Button(text="SUMAR", command=sumar)
- boton.place(x=20, y=50, width=100, height=30)
- etiqueta = tk.Label(text="Primer sumando:")
- etiqueta.place(x=20, y=90)
- caja_A = tk.Entry()
- caja_A.place(x=140, y=90, width=50, height=25)
- etiqueta = tk.Label(text="Segundo sumando:")
- etiqueta.place(x=20, y=140)
- caja_B = tk.Entry()
- caja_B.place(x=140, y=140, width=50, height=25)
- etiqueta = tk.Label(text="SUMA:")
- etiqueta.place(x=20, y=190)
- pantalla = tk.Entry(textvariable = total)
- pantalla.place(x=140, y=190, width=50, height=25)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment