The two variations seem to have identical results when they are
implemented for a control. How do those controls know that its class
variable has been changed? This can be done with a timer, but having
every single control implement a timer just to monitor its own class
variables for any changes seems very expensive in terms of resources.
Besides, the question remains as to how often to check for any changes
to get an acceptable lag time.
Is there an easier built-in way to monitor class variable changes ?
How do existing controls do this ?
The two variations seem to have identical results when they are
implemented for a control. How do those controls know that its class
variable has been changed? This can be done with a timer, but having
every single control implement a timer just to monitor its own class
variables for any changes seems very expensive in terms of resources.
Besides, the question remains as to how often to check for any changes
to get an acceptable lag time.
Is there an easier built-in way to monitor class variable changes ?
How do existing controls do this ?
Window.Size is a property so depending upon what side of the '=' sign
it is it will cause either SetSize or GetSize to be called.
class Window(EvtHandler):
...
Size = property(GetSize,SetSize,doc="See `GetSize` and `SetSize`")
When the size is modifed by calling SetSize it causes a SizeEvent to
be triggered which in turn leads to the SizeEvent callback being
called to do the visible resizing of the window.
To monitor variable changes you can do something similar in your class
for variables that need to be monitored by generating events when
their setter is called, or use some other sort of observer pattern
with pubsub or similar mechanism.
Cody
ยทยทยท
On Thu, Aug 19, 2010 at 2:03 PM, WinCrazy <pascor@verizon.net> wrote: