Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter import messagebox
  3.  
  4. # Create the window
  5. top = Tk()
  6. top.geometry("300x150")
  7.  
  8.  
  9. # Event handlers
  10. def do_calculation():
  11. # TODO handler code goes here
  12. pass
  13.  
  14.  
  15. # TODO Widgets go here
  16. lbl_num1 = Label(top, text="Num 1")
  17. lbl_num1.place(x=5, y=5)
  18.  
  19. lbl_num2 = Label(top, text="Num 2")
  20. lbl_num2.place(x=5, y=30)
  21.  
  22. lbl_operation = Label(top, text="Operation")
  23. lbl_operation.place(x=5, y=55)
  24.  
  25. txt_num1 = Entry(top)
  26. txt_num1.place(x=90, y=5)
  27.  
  28. txt_num2 = Entry(top)
  29. txt_num2.place(x=90, y=30)
  30.  
  31. om_operation_text = StringVar()
  32. om_operation_text.set("+")
  33. om_operation = OptionMenu(top, om_operation_text, "+", "-", "*", "/")
  34. om_operation.place(x=90, y=60)
  35.  
  36. btn_calculate = Button(top, text="Calculate", command=do_calculation)
  37. btn_calculate.place(x=90, y=90)
  38.  
  39. lbl_result_text = StringVar()
  40. lbl_result = Label(top, textvariable=lbl_result_text, font="Helvetica 18 bold")
  41. lbl_result_text.set("0")
  42. lbl_result.place(x=90, y=120)
  43.  
  44.  
  45. # Show the window
  46. top.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement