figuring out location of open slots in various containers



Gtk (at least 1.3.x) allows widget reparenting.  This is very cool, but it
seems to me some are functions missing in various container classes that
would let the programmer know where child widgets could be attached.  In
particular, the Gtk[HV]Paned and GtkTable widgets don't seem to allow the
programmer to discover the location of their children, nor do they object
when you put multiple widgets into a particular slot.  This seems like it
should raise an error:

    p = gtk.GtkVPaned()
    b = gtk.GtkButton(label="hi")
    p.add1(b)
    b = gtk.GtkButton(label="bye")
    p.add1(b)

since I apparently can't call something like p.get1() to find out if there
is a child in the pane's "one" slot.  Similarly, I think GtkTable widgets
would benefit from a get_child(row,col) method.  (Alternatively, they could
raise an error if you tried to put two widgets into the same slot).  I
haven't finished considering all the container types, so there may be others
with similar gaps.  (GtkBins are easy because they can only have a single
child.)

I'm using the PyGtk interface, so perhaps I'm looking at these widgets
through a slightly incomplete interface, but I just couldn't see a way to do
what I want from the reference docs.

If there's agreement from the developers that I am observing missing
functionality, give me some function prototypes and I'll try to generate
some candidate implementations.

-- 
Skip Montanaro (skip pobox com)
(847)971-7098




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]