Guest User

Untitled

a guest
Mar 23rd, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import tkinter as tk
  4.  
  5. root = tk.Tk()
  6.  
  7. frame0 = tk.Frame(root)
  8. frame0.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)
  9. frame1 = tk.Frame(root)
  10. frame1.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
  11. frame2 = tk.Frame(root)
  12. frame2.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
  13. frame3 = tk.Frame(root)
  14. frame3.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
  15. frame4 = tk.Frame(root)
  16. frame4.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH)
  17.  
  18. entry1 = tk.Entry(frame0, width=25)
  19.  
  20. def button1_insert():
  21. entry1.insert(tk.END, 1)
  22.  
  23. entry1.pack(expand=tk.YES, fill=tk.X)
  24.  
  25. button1 = tk.Button(frame1, text='7', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  26. button2 = tk.Button(frame1, text='4', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  27. button3 = tk.Button(frame1, text='1', width=5, command=button1_insert).pack(expand=tk.YES, fill=tk.BOTH)
  28. button4 = tk.Button(frame1, text='0', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  29.  
  30. button5 = tk.Button(frame2, text='8', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  31. button6 = tk.Button(frame2, text='5', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  32. button7 = tk.Button(frame2, text='2', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  33. button8 = tk.Button(frame2, text='.', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  34.  
  35. button9 = tk.Button(frame3, text='9', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  36. button10 = tk.Button(frame3, text='6', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  37. button11 = tk.Button(frame3, text='3', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  38. button12 = tk.Button(frame3, text='=', width=5).pack(expand=tk.YES, fill=tk.BOTH)
  39.  
  40. button13 = tk.Button(frame4, text='<-', width=4).pack(expand=tk.YES, fill=tk.BOTH)
  41. button14 = tk.Button(frame4, text='/', width=4).pack(expand=tk.YES, fill=tk.BOTH)
  42. button15 = tk.Button(frame4, text='*', width=4).pack(expand=tk.YES, fill=tk.BOTH)
  43. button16 = tk.Button(frame4, text='-', width=4).pack(expand=tk.YES, fill=tk.BOTH)
  44. button17 = tk.Button(frame4, text='+', width=4).pack(expand=tk.YES, fill=tk.BOTH)
  45.  
  46. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment