main.py 864 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. from sensors.acusticSensor import AcusticSensor
  2. from sensors.calibration import CalibrationStateMashine
  3. from gui.mainWindow import MainWindow
  4. import queue
  5. import configparser
  6. import tkinter as tk
  7. import traceback
  8. conf = configparser.ConfigParser()
  9. conf.read('config.ini')
  10. def main():
  11. ac_queue = queue.Queue()
  12. ac_calibration_state = CalibrationStateMashine()
  13. ac_sensor = AcusticSensor(conf, ac_queue, ac_calibration_state)
  14. try:
  15. ac_sensor.start()
  16. root = tk.Tk()
  17. root.title("Tracking System")
  18. root.state("zoomed")
  19. view = MainWindow(root, ac_sensor, ac_queue, ac_calibration_state)
  20. view.pack(side="top", fill="both", expand=True)
  21. view.update()
  22. root.mainloop()
  23. except KeyboardInterrupt:
  24. print("stop")
  25. except Exception as e:
  26. print("Error: ",e)
  27. traceback.print_exc()
  28. finally:
  29. ac_sensor.stop()
  30. main()