[pygtk] Multi-paned window

egbert egbert.bouwman at hccnet.nl
Wed Jan 25 03:00:49 WST 2006


On Tue, Jan 24, 2006 at 04:58:14PM +0100, Luigi Paioro wrote:

> Furthermore, for a lot of widgets to pack, the code becomes 
> very confused.

I have rearranged your script in a way which makes it more readable
and less confused, at least in my opinion:

    #!/usr/bin/env python
    import gtk

    w1 = gtk.TextView()
    w2 = gtk.TextView()
    w3 = gtk.TextView()

    vpaned1 = gtk.VPaned()
    vpaned1.add1(w1)

    vpaned2 = gtk.VPaned()
    vpaned2.add1(w2)
    vpaned2.add2(w3)

    vpaned1.add2(vpaned2)

    window = gtk.Window(gtk.WINDOW_TOPLEVEL)
    window.add(vpaned1)
    window.show_all()

    gtk.main()

The idea is that you create containers at the moment that you
need them, and not earlier.
So you start with the innermost widget, and only at the end 
you create and fill and show the toplevel window.
egbert


-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================


More information about the pygtk mailing list