[pygtk] Glade, event handlers, & gtk.Builder question
Adam Tauno Williams
awilliam at whitemice.org
Fri Feb 11 22:13:14 WST 2011
On Fri, 2011-02-11 at 08:23 -0500, H3L0 wrote:
> On 2/11/2011 6:44 AM, Adam Tauno Williams wrote:
> > On Wed, 2011-02-09 at 14:57 +0100, Alessandro Dentella wrote:
> > > > way to only connect event handlers for the "MainWindow" widget? Do I
> > > > need to define each widget in a separate Glade file?
> > > In the Builder documentations it says:
> > > The connect_signals() method uses Python's introspective features to look at
> > > the keys (if object is a mapping) or attributes (if object is an instance)
> > > and tries to match them with the signal handler names given in the interface
> > > description. The callbacks referenced by each matched key or attribute are
> > > connected to their matching signals.
> > > So that you can pass a dict with only the keys corresponding to the handler
> > > you need to connect.
> > Yes, I read that something like twelve times - I just assumed I was
> > missing something - because, ugh... that diminishes the value of a GUI
> > builder. It seems the advice should then be to place each window /
> > entity in a separate Glade file. [If two entities in a Glade file have
> > a handler of the same name... where does it get bound to? This really
> > seems non-intuitive].
> why not just connect the signals you need to manually? you can connect
> just the signals you need to while still using Glade to build the GUI.
> Just use the gtk.glade.xml class. from my understanding you can
> specify the signals you want to connect individually, but I haven't
> used it in my code so I am not sure.
I don't really have any interest in a debate, but I'd ask: "Why do I
have to manually connect signals?" What is the point [there isn't one,
IMO]. When building interfaces in .NET or other platforms I've never
had to write dozens of lines of code just to connect event handlers. I
shouldn't have to do anything but write-the-code-for-the-event, the
rest is just plumbing.
More information about the pygtk
mailing list