Message60719
in class Variable the constructor uses self.set() to set
the value of the variable. This makes it hard and in some
cases impossible to make a speciallization of Variable
that performs some operation after changing the value. It
would be preferable to use Tkinter.Variable.set(self,
self._default)
example:
class ViewChanger(Tkinter.StringVar) :
def __init__(self, views) :
self.views = views
Tkinter.StringVar.__init__(self)
def set(self, newview) :
self.views.activate(newview)
Tkinter.StringVar.set(newview)
get() and everything else will use the normal StringVar
ipementation, but when the value is changed, a new view
is activated.
At creation here the self.views varaible will be accessed,
method activate() will be called, and it might not even be
fully initiallized yet. This is the normal case if you want
to supply a variable to a widget, where a variable change
may update the widget. |
|
Date |
User |
Action |
Args |
2008-01-20 09:57:44 | admin | link | issue1178863 messages |
2008-01-20 09:57:44 | admin | create | |
|