I have a slider and I want to call a specific function only when the interaction is complete. The idea is to call a function after 500ms (and not before). If the slider continues to move then the call is canceled. In other words, if the slider "rests" for more than 500ms than the function is call.
Thanks
Update
#slider
def updateValue(self):
#self._job = None
#self.preview.updateContourValue(float(self.slider.get() ))
print "updated value"
timer = Timer(5.0, updateValue)
def sliderCallback(self):
timer.cancel()
timer.start()
Patrick: See this thread - How to create a timer using tkinter?
You can use Threading.Timer to do this. It has a cancel
method that you can use to cancel it before it runs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With