Popup.py 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. import tkinter as tk
  2. import tkinter.messagebox
  3. import time
  4. import queue
  5. class CalibrationPopUp(tk.Frame):
  6. def __init__(self, root, up_queue, down_queue,calibration_state):
  7. self.root = root
  8. self.calibration_state = calibration_state
  9. self.down_queue = down_queue
  10. self.up_queue = up_queue
  11. tk.Frame.__init__(self, root)
  12. self.killed = False
  13. self.instruction = tk.Label(self,text="Start Calibration", anchor="c",font=("Courier",18))
  14. self.instruction.pack(side="top", fill="both", expand=True)
  15. button = tk.Button(self,text="OK", command=self.calibration_state.next_state_gui, anchor="c",height=1,width=5)
  16. button.pack(side="top", fill="both", expand=True)
  17. self.cs = tk.Label(self,text=self.calibration_state.state_clearname(), anchor="c")
  18. self.cs.pack(side="top", fill="both", expand=True)
  19. def update(self):
  20. self.cs["text"] = self.calibration_state.state_clearname()
  21. if self.calibration_state.get_state() == self.calibration_state.WAITING_POS_1:
  22. self.instruction["text"] = "Move gondola to far left corner!"
  23. elif self.calibration_state.get_state() == self.calibration_state.WAITING_POS_2:
  24. self.instruction["text"] = "Move gondola to far right corner!"
  25. elif self.calibration_state.get_state() == self.calibration_state.CALIBRATION_DONE:
  26. self.instruction["text"] = "Calibration Done!"
  27. else:
  28. self.instruction["text"] = "Processing..."