python - tkinter Scale Widget - Return to center when not being used? -
is possible make scale widget return center of scale when not in use?
currently, if click , drag scale widget 1 side, remain in position when unclick slider. possible make slider return center when unclicked / no longer being dragged?
current code work on:
w = scale(master, from_=0, to=1, orient=horizontal, command=some_function) w.pack()
the simplest solution bind event <buttonrelease-
>, trigger when release mouse button. can call set
method set value whatever want.
for example:
self.scale = tk.scale(...) self.scale.bind("<buttonrelease-1>", self.reset_scale) ... def reset_scale(self, event): self.scale.set(0)
Comments
Post a Comment