Mercurial > code > home > repos > light9
diff light8/uihelpers.py @ 95:d5deeed83228
FancyDoubleVar is a DoubleVar where you can temporarily disable the callbacks
FancyDoubleVar is a DoubleVar where you can temporarily disable the callbacks
(at least the ones you made in python)
author | drewp |
---|---|
date | Sat, 13 Jul 2002 03:27:19 +0000 |
parents | d34a4956417a |
children | 139d6ed2fbaa |
line wrap: on
line diff
--- a/light8/uihelpers.py Sat Jul 13 03:23:35 2002 +0000 +++ b/light8/uihelpers.py Sat Jul 13 03:27:19 2002 +0000 @@ -153,6 +153,27 @@ self.config(bg=self._origbkg,relief='raised') return "break" + +class FancyDoubleVar(DoubleVar): + def __init__(self,master=None): + DoubleVar.__init__(self,master) + self.callbacklist = {} + def trace_variable(self,mode,callback): + + # we build a list of the trace callbacks (the py functrions and the tcl functionnames) + id=DoubleVar.trace_variable(self,mode,callback) + + self.callbacklist[id]= [mode,callback] + + return id + + def disable_traces(self): + for k,v in self.callbacklist.items(): + self.trace_vdelete(v[0],k) + def recreate_traces(self): + for k,v in self.callbacklist.items(): + self.trace_variable(v[0],v[1]) + if __name__=='__main__': root=Tk() root.tk_focusFollowsMouse()