The attached subclass of gtk.GtkTable functions as a more-or-less pythonic
container.  By "pythonic" I mean it uses Python's sequence notation to
specify attachment points and column/row spans.  This code is somewhat
incomplete in the following ways:

    1. Not included here is a class that works more-or-less like a
       Gtk[HV]Box (one-dimensional list) and allows the orientation to be
       flipped after instantiation (one of my biggest peeves with all the
       various Gtk[HV]* widgets is that this isn't possible).  I'm still
       working on some bugs there.

    2. Unlike the add method of existing Gtk containers, this class's add
       method attempts to find an empty slot for the child being added
       instead of just dumping it in whatever the "first slot" for the
       container happens to be.  This works most of the time, but it still
       has some bugs.

    3. There is a shrinkwrap method that squeezes out empty columns along
       the right edge and rows along the bottom edge.  It fails to squeeze
       out empty columns or rows elsewhere, however.

    4. The homogeneous button in the demo doesn't update its label
       appropriately.  (It should probably be a check button anyway, but I'd
       still like to know how to force the application's widgets to update.)

    5. There are probably some more sequence methods that could be
       implemented (count, __contains__, index, etc).  My not-quite-yet
       working Box class implements append, but could also implement insert.

This code is written assuming the new Gtk+ 2.0 API but doesn't yet use the
new streamlined class names James announced the other day.  I have no idea
if it can be adapted to the Gtk+ 1.2 API.

All feedback is welcome.

-- 
Skip Montanaro ([EMAIL PROTECTED])
http://www.mojam.com/
http://www.musi-cal.com/

Pythonic table widget

Reply via email to