comparison 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
comparison
equal deleted inserted replaced
94:29a8b23d8db5 95:d5deeed83228
151 self.config(bg=self.downcolor,relief='sunken') 151 self.config(bg=self.downcolor,relief='sunken')
152 else: # unset 152 else: # unset
153 self.config(bg=self._origbkg,relief='raised') 153 self.config(bg=self._origbkg,relief='raised')
154 return "break" 154 return "break"
155 155
156
157 class FancyDoubleVar(DoubleVar):
158 def __init__(self,master=None):
159 DoubleVar.__init__(self,master)
160 self.callbacklist = {}
161 def trace_variable(self,mode,callback):
162
163 # we build a list of the trace callbacks (the py functrions and the tcl functionnames)
164 id=DoubleVar.trace_variable(self,mode,callback)
165
166 self.callbacklist[id]= [mode,callback]
167
168 return id
169
170 def disable_traces(self):
171 for k,v in self.callbacklist.items():
172 self.trace_vdelete(v[0],k)
173 def recreate_traces(self):
174 for k,v in self.callbacklist.items():
175 self.trace_variable(v[0],v[1])
176
156 if __name__=='__main__': 177 if __name__=='__main__':
157 root=Tk() 178 root=Tk()
158 root.tk_focusFollowsMouse() 179 root.tk_focusFollowsMouse()
159 iv=IntVar() 180 iv=IntVar()
160 def cb(): 181 def cb():