inhahe wrote:
it would be nice to see PyGUI turn into something like PyQt - but of
course a lot lightweight and therefore probably with a simpler
interface.. mainly what i like about PyQt is its signals and slots
mechanism.
I'm not all that familiar with Qt, but my experiences with
gtk make me less than enthusiastic about the signal/slot
paradigm for event handling. I find it tedious having to
make a bunch of calls to plug in event handlers every time
I create a widget.
The PyGUI philosophy for event handling is that you don't
have to explicitly connect events, you just define a method
to handle the event at the appropriate point in the widget
hierarchy.
Having said that, an action property with a bound method
plugged into it is fairly similar to a Qt signal-slot
connection. The main difference is that you can't directly
connect more than one handler at a time. I haven't found
that to be much of a disadvantage in practice -- usually
my hander is a method of the containing Window or Dialog,
which is in a position to fire off whatever actions are
necessary.
although if you don't provide one I hope that it would at least be
possible to create identical support for it implemented purely in
Python somehow. i'm guessing that would be relatively easy just by
creating a connect function that modifies action properties..
Yes, it wouldn't be too hard to create an adaptor that
you could plug into an action property. It would maintain
a list of handlers and have a __call__ method that passes
the call on to all of them.
Here's a quick sketch (untested):
class ActionDistributor(list):
def __call__(self, *args, **kwds):
for handler in self:
handler(*args, **kwds)
--
Greg
_______________________________________________
Pygui mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pygui