Это мой код:
Код: Выделить всё
class Window(Tk):
def __init__(self, serial):
super().__init__()
self.serial = serial
self.button = Button(text="Home", command=self.serial.home)
self.button.pack()
self.lin_stage = Scale(
from_=0,
to=self.serial.range[0],
command=self.set_value,
orient=HORIZONTAL,
state="normal",
relief="groove",
activebackground="blue",
)
self.lin_stage.grab_release()
self.lin_stage.pack()
def handle_button_press(self):
self.destroy()
def set_value(self, val):
val = float(val)
print(val)
# return self.serial.set_position(val, axis=0)
if __name__ == "__main__":
woco = WOOPTIXController(port="COM3", baudrate=115200, n_axis=2)
# Start the event loop.
win = Window(woco)
win.mainloop()

Как видно, функция печатает все значения, пока не будет достигнуто значение 20. Как я могу получить только последний?
Подробнее здесь: https://stackoverflow.com/questions/790 ... -the-mouse