On Wed, Jul 06, 2005 at 09:23:44AM -0300, Jose de Paula Eufrasio Junior wrote:
> I'm making a pygtk app and got several fields wich values are inserted
> (like textviews, spinbuttons) and these values can be changed with
> values from other widgets on the app.
> I'm not very friendly to the idea of a 'refresh' button, and like to
> know from you guys what's the best manner to do it...
You probably want to use the Observer pattern. A simplified Pythonic
version would be something like
def addCallback(self, cb):
self._callbacks.append(cb)
...
def notify(self, *args, **kw):
for cb in self._callbacks:
cb(self, *args, **kw)
You can find a lot fancier variants (e.g. publish/subscribe) of this on the
web.
You can also create your own gobject signals or watch for changes in gobject
properties.
Dave Cook
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/