Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import tkinter as tk
- ventana = tk.Tk()
- ventana.config(width=400, height=600, bg="slate gray")
- ventana.title("Ventana")
- def sumar():
- a = float(caja_a.get())
- b = float(caja_b.get())
- suma = a + b
- total.set(str(suma))
- total = tk.StringVar() # total = "0"
- total.set("0")
- caja_a = tk.Entry(font = ["arial",15,"bold"], justify="right")
- caja_a.place(x=20, y=50, width=100, height=25)
- caja_b = tk.Entry(font=["arial",15,"bold"], justify="right")
- caja_b.place(x=220, y=50, width=100, height=25)
- caja_c = tk.Entry(
- font =["arial",15,"bold"],
- justify="right",
- state= tk.DISABLED,
- textvariable = total,
- )
- caja_c.place(x=150, y=100, width=100, height=25)
- boton = tk.Button(text="Sumar", command=sumar)
- boton.place(x=150, y=200, width=100, height=40)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement