Advertisement
Guest User

123

a guest
Jan 11th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. def calculator():
  4.     res = '{}'. format(txt.get())
  5.     res = int(res)
  6.     lbl.configure(text=res)
  7.  
  8.  
  9. window = Tk()
  10. window.title('calculator')
  11. window.geometry('400x250')
  12. btn = Button(window, text = '~~~', command=calculator)
  13. btn.grid(column=6, row=0)
  14. lbl = Label(window, text='0')
  15. lbl.grid(column=8, row=0)
  16. txt = Entry(window,width=10)
  17. txt.grid(column=4, row = 0)
  18. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement