浏览代码

changed window placement

subDesTagesMitExtraKaese 3 年之前
父节点
当前提交
4e28696e0f
共有 3 个文件被更改,包括 9 次插入5 次删除
  1. 0 4
      raspberry-pi/gui/Popup.py
  2. 8 1
      raspberry-pi/gui/mainWindow.py
  3. 1 0
      raspberry-pi/main.py

+ 0 - 4
raspberry-pi/gui/Popup.py

@@ -1,9 +1,5 @@
 import tkinter as tk
 from tkinter.ttk import Progressbar
-import tkinter.messagebox
-import time
-import queue
-
 
 class CalibrationPopUp(tk.Frame):
   def __init__(self, root, calibration_state):

+ 8 - 1
raspberry-pi/gui/mainWindow.py

@@ -79,10 +79,17 @@ class MainWindow(tk.Frame):
   def calibrate(self):
     self.ac_sensor.start_calibration()
     if not self.popup or not self.pu_root.winfo_exists():
+      # create new window
       self.pu_root = tk.Toplevel(self.root)
       self.pu_root.wm_transient(self.root)
       self.pu_root.wm_title("Calibration")
-      self.pu_root.geometry("500x200")
+
+      # make it centered
+      x = (self.pu_root.winfo_screenwidth()  - 500) / 2
+      y = (self.pu_root.winfo_screenheight() - 200) / 2
+      self.pu_root.geometry(f'500x200+{int(x)}+{int(y)}')
+
+      # deactivate mainWindow
       self.pu_root.grab_set()
       self.popup = CalibrationPopUp(self.pu_root, self.ac_cal_state)
       self.popup.pack(side="top", fill="both", expand=True)

+ 1 - 0
raspberry-pi/main.py

@@ -19,6 +19,7 @@ def main():
     ac_sensor.start()
     root = tk.Tk()
     root.title("Tracking System")
+    root.state("zoomed")
     view = MainWindow(root, ac_sensor, ac_queue, ac_calibration_state)
     view.pack(side="top", fill="both", expand=True)
     view.update()