Browse Source

added dro

subDesTagesMitExtraKaese 4 years ago
parent
commit
cc7b355b55
1 changed files with 9 additions and 3 deletions
  1. 9 3
      raspberry-pi/gui/mainWindow.py

+ 9 - 3
raspberry-pi/gui/mainWindow.py

@@ -20,10 +20,14 @@ class MainWindow(tk.Frame):
     self.controls = tk.Frame(self)
     self.controls.pack(fill=tk.BOTH, side=tk.RIGHT)
 
-    l = tk.Label(self.controls, text="your widgets go here...", anchor="c")
-    l.pack(side="top", fill="both", expand=True)
+    self.ac_dro_x = tk.StringVar()
+    self.ac_dro_y = tk.StringVar()
+    tk.Label(self.controls, text="Acustic Sensor", anchor="c").pack(side="top", fill="both", expand=False)
+    tk.Label(self.controls, textvariable=self.ac_dro_x, anchor="nw").pack(side="top", fill="both", expand=False)
+    tk.Label(self.controls, textvariable=self.ac_dro_y, anchor="nw").pack(side="top", fill="both", expand=False)
+
     calibrate_button = tk.Button(self.controls,text="calibrate",command=self.calibrate)
-    calibrate_button.pack(side="top")
+    calibrate_button.pack(side="top", fill="both")
 
   def update(self):
     ac_data = []
@@ -33,6 +37,8 @@ class MainWindow(tk.Frame):
         ac_data.append(data)
     if len(ac_data) > 0:
       self.graph.update([ac_data])
+      self.ac_dro_x.set("X: {:3.1f} mm".format(ac_data[-1][0]))
+      self.ac_dro_y.set("Y: {:3.1f} mm".format(ac_data[-1][1]))
 
     if self.popup:
       self.popup.update()