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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -