subDesTagesMitExtraKaese 3 лет назад
Родитель
Сommit
d23fc66afe
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      raspberry-pi/gui/mainWindow.py

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

@@ -30,7 +30,8 @@ class MainWindow(tk.Frame):
     self.ac_dro_y = tk.StringVar()
     self.ac_dro_t1 = tk.StringVar()
     self.ac_dro_t2 = tk.StringVar()
-    tk.Label(self.controls, text="Acustic Sensor", anchor="c", font=("Helvatica", 10, 'bold')).pack(side="top", fill="both", expand=False)
+    self.ac_label = tk.Label(self.controls, text="Acustic Sensor", anchor="c", font=("Helvatica", 10, 'bold'))
+    self.ac_label.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)
     tk.Label(self.controls, textvariable=self.ac_dro_t1, anchor="nw").pack(side="top", fill="both", expand=False)
@@ -61,6 +62,14 @@ class MainWindow(tk.Frame):
     # graph shows all values as a line
     self.graph.update([ac_positions])
 
+    # update status color
+    if self.ac_sensor.dummyActive:
+      self.ac_label.config(fg="white", bg="red")
+    elif len(ac_positions) > 0:
+      self.ac_label.config(fg="white", bg="green")
+    else:
+      self.ac_label.config(fg="black", bg="yellow")
+
     # readouts will only be updated so often
     if self.controlsUpdateTime + 0.4 < time.time():
       self.controlsUpdateTime = time.time()