[pygtk-1.99.17, python-2.3.3, x86 linux]
I found (and solved!) a frustrating little gotcha, so I'm posting it
here. Let it not be said that I only post whiney questions...
A simple app with a liststore in a treeview in a vbox in a window was
failing in an odd way. The window popped up with no errors, column
headers were visible, and a thin sliver part of one row of the liststore.
I eventually found that I had specified vbox.pack_start(sw, False,
False, 0), those options being what I usually want. In fact it seems that
the second and third args, "expand" and "fill", respectively, must both be
True (the default) for the scrolledwindow to function usefully:
______________________________________________________________________
topwin = gtk.Window(gtk.WINDOW_TOPLEVEL) topwin.set_default_size(-1, 150)
vb = gtk.VBox() topwin.add(vb) (LETTER_COL,COLOR_COL) = 0, 1 ls =
gtk.ListStore(str, str) for x,y in
(('a','yellow'),('b','green'),('c','red')): ls.set(ls.append(),
LETTER_COL, x, COLOR_COL, y) tv = gtk.TreeView(ls)
for name,num in (('letter', LETTER_COL), ('color', COLOR_COL)):
rend = gtk.CellRendererText()
col = gtk.TreeViewColumn(name, rend, text=num)
tv.append_column(col)
sw = gtk.ScrolledWindow()
vb.pack_start(sw, True, True, 0)#good
#vb.pack_start(sw, True, False, 0)#bad
#vb.pack_start(sw, False, False, 0)#bad
#vb.pack_start(sw, False, True, 0)#bad
sw.add(tv)
topwin.show_all()
gtk.mainloop()
----------------------------------------------------------------------
Maybe this is obvious to those with a deep grasp of Box packing semantics,
but it certainly took me a while to figure out...
Perhaps this should be a FAQ? Or is it really too obvious?
-- George
--
"Are the gods not just?" "Oh no, child.
What would become of us if they were?" (CSL)
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/