def refresh(self): self.canvas.delete("all") data = Client().request_data() data_iterable = data.items() for counter, (key, value) in enumerate(data_iterable): value = round(value, 5) self.canvas.create_text(20, counter * self.t_height + 50, text=f"{key}: {value}", anchor='w') self.canvas.create_rectangle(200, counter * self.t_height + 40, 200 + value, counter * self.t_height + 60, fill="#000")
def __init__(self, root): super().__init__(root, FRAME_CONFIG) self.connect_button = Button(self, text="Connect to Robot", cnf=BUTTON_CONFIG, bg='green', command=Client().connect) self.connect_button.pack(expand=1)
def animation(): Client().request_rgb_effect()
def led(r, g, b): Client().request_led(r, g, b)
def calibrate_white(): Client().request_calibration(CalibrationTarget.COLOR_WHITE)
def calibrate_victim(): Client().request_calibration(CalibrationTarget.COLOR_RED)
def calibrate(value): Client().request_calibration()
def get_interpreted(): Client().request_interpreted()
def refresh(self): i_data = Client().request_interpreted() print(i_data) color = "#fff" if i_data[1] > i_data[0] else "#f00" self.canvas.create_rectangle(40, 40, 100, 100, fill=color)
def on_window_close(self): Client().request_quit() self.destroy()