[pygtk] Window grows too much when loading data into TreeView

Roberto Bonvallet rbonvall+pygtk at gmail.com
Tue Oct 14 10:25:42 WST 2008


Dear all,
I have written a small PyGTK program for the first time in order to help me
visualize some data, but I have this problem I hope someone can help me to
solve.

The window contains a VBox, whose bottom cell contains a HBox with a
TreeView and its VScrollbar.  The TreeView is populated by loading data from
a file when the user presses a button.

I tested my program in a tiled window manager (Ion3), where the window size
is fixed by the containing tile, and it works fine: the TreeView fits the
window and can be scrolled down with the VScrollbar.

But now I've run my program in Gnome, and now the TreeView grows to show all
its contents, so I get a very tall window that doesn't fit the screen and
the scrollbar doesn't work, so I can only see the first handful of rows.

I have set the window default size, and changed the window size after
loading the data, but it doesn't help.

The relevant widget creation and packing code:
[...]
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_default_size(200, 400)

        self.vbox = gtk.VBox()
        self.window.add(self.vbox)
        self.data_box = gtk.HBox()
        self.vbox.pack_start(self.data_box, expand=True)

        self.data_view = gtk.TreeView()
        self.data_box.pack_start(self.data_view, expand=True)

        v = self.data_view.get_vadjustment()
        self.sb = gtk.VScrollbar(adjustment=v)
        self.data_box.pack_start(self.sb, expand=False)
[...]

Does anybody know what's wrong, and how could I solve this?
I'd be very thankful for any hint.

Cheers,
-- 
Roberto Bonvallet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20081013/ecc67a4c/attachment.htm 


More information about the pygtk mailing list