Advertisement
Guest User

s

a guest
Jan 12th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. root = Tk()
  4. root.title("Calculator")
  5. root.geometry("300x450")
  6. root.resizable(False, False)
  7. def xueta():
  8. print("1")
  9.  
  10.  
  11. frame = Frame()
  12. frame.place(height=300, width=300, x=0, y=150)
  13.  
  14. btn1 = Button(frame, text="1", width=50, height=50, command=xueta)
  15. btn2 = Button(frame, text="2", width=50, height=50)
  16. btn3 = Button(frame, text="3", width=50, height=50)
  17. btn4 = Button(frame, text="4", width=50, height=50)
  18. btn5 = Button(frame, text="5", width=50, height=50)
  19. btn6 = Button(frame, text="6", width=50, height=50)
  20. btn7 = Button(frame, text="7", width=50, height=50)
  21. btn8 = Button(frame, text="8", width=50, height=50)
  22. btn9 = Button(frame, text="9", width=50, height=50)
  23.  
  24. btn_plus = Button(frame, text="+", width=50, height=50)
  25. btn_minus = Button(frame, text="-", width=50, height=50)
  26. btn_multiply = Button(frame, text="*", width=50, height=50)
  27. btn_divide = Button(frame, text="/", width=50, height=50)
  28. btn_degree = Button(frame, text="^", width=50, height=50)
  29. btn_c = Button(frame, text="C", width=50, height=50)
  30. btn_root = Button(frame, text="R", width=50, height=50)
  31.  
  32.  
  33. btn1.place(x=0, y=0)
  34. btn2.place(x=75, y=0)
  35. btn3.place(x=150, y=0)
  36. btn_plus.place(x=225, y=0)
  37.  
  38. btn4.place(x=0, y=75)
  39. btn5.place(x=75, y=75)
  40. btn6.place(x=150, y=75)
  41. btn_minus.place(x=225, y=75)
  42.  
  43. btn7.place(x=0, y=150)
  44. btn8.place(x=75, y=150)
  45. btn9.place(x=150, y=150)
  46. btn_divide.place(x=225, y=150)
  47.  
  48. btn_multiply.place(x=0, y=225)
  49. btn_degree.place(x=75, y=225)
  50. btn_root.place(x=225, y=225)
  51. btn_c.place(x=150, y=225)
  52.  
  53. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement