Advertisement
Anonimus213

Untitled

Apr 22nd, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. from tkinter import *
  2. tk = Tk()
  3. tk.title('Простой калькулятор')
  4. tk.resizable(0,0)
  5. calculator_entry = Entry(tk, font = ('arial', 20, 'bold'), justify = 'right', width = 32, bd = 3)
  6. calculator_entry.grid(row = 0, column = 0, columnspan = 6)
  7. calculator_entry.insert(0, '0')
  8. bttn_list = [
  9. '7', '8', '9', '+', '-', '±',
  10. '4', '5', '6', '*', '÷', 'π',
  11. '1', '2', '3', 'x²', '√', '⌫',
  12. 'C', '0', '.', '(', ')', '=',
  13. ]
  14. r = 1
  15. c = 0
  16. for i in bttn_list:
  17. btn = Button(tk, font = ('arial', 15, 'bold'), width = 6, height = 3, text = i).grid(row = r, column = c)
  18. c += 1
  19. if c>5:
  20. c = 0
  21. r += 1
  22. tk.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement