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