Reputation: 64834
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()
Upvotes: 5
Views: 6948
Reputation: 70984
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.
Upvotes: 2