The class MyModel contains a field called counter to hold the value of a numeric counter. Since we are interested in monitoring and show any change of this counter, we declare it as an observable property.
from gtkmvc.model import Model
class MyModel (Model):
# observable properties:
__properties__ = { 'counter' : 0 }
def __init__(self):
Model.__init__(self)
return
pass # end of class
All that it is required to do, is calling class Model's constructor from within the derived class' constructor, and defining a class variable __properties__ containing the name of the observable properties, and the associated initial values. The class Model will do all the boring work automatically.