Advertisement
Guest User

Untitled

a guest
Mar 24th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. root = tk.Tk()
  4. root.title('Calculatov v2.0')
  5.  
  6.  
  7. def insert_nums(num):
  8. entry1.insert(tk.END, num)
  9.  
  10.  
  11. buttons = [
  12. '7', '4', '1', '0',
  13. '8', '5', '2', '.',
  14. '9', '6', '3', '=',
  15. '<<<', '/', '*', '-', '+',
  16. ]
  17.  
  18. frame0 = tk.Frame(root)
  19. frame0.pack(expand=tk.YES, fill=tk.BOTH)
  20. frame1 = tk.Frame(root)
  21. frame1.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
  22.  
  23. entry1 = tk.Entry(frame0, bg='#2C3033', fg='#FFFFFF', font='Helvetica 18 bold', bd='10')
  24. entry1.pack(expand=tk.YES, fill=tk.BOTH)
  25.  
  26. for button in buttons[0:4]:
  27. Button = tk.Button(frame1, text=button, width=5, heigh=2, bg='#202125', fg='#FFFFFF', font='Helvetica 18 bold', command=insert_nums(button))
  28. Button.pack(expand=tk.YES, fill=tk.BOTH)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement