2010/8/6 José Luis Segura Lucas <josel.seg...@gmx.es> > Hello! > > I'm using a scrolled window widget inside a notebook page (the second page > of my notebook). > > If I go to the second page, I see the scrolled window empty, and if I > return to the first notebook page again and add some elements, then I can > see the elements on the second page. > > But, if I don't go to the second page BEFORE adding some elements to the > scrolled window, such elements are not shown. > > When I go to the scrolled window page and return to the firsr page and add > some elements, the oldest and the newest are shown correctly. > > This problem only happens once per execution of the program. > > I send you a little snippet that has the problem too: > > #!/usr/bin/python2.6 > # -*- coding: utf-8; mode: python -*- > > import gtk > import gobject > > def add_to_tab2(btn, data=None): > global box > box.pack_start(gtk.Label('Something')) > box.pack_start(gtk.HSeparator()) > box.show_all() > > win = gtk.Window() > > notebook = gtk.Notebook() > > # Contained on first tab > btn = gtk.Button('Add to 2nd tab') > btn.connect('clicked', add_to_tab2) > > # Contained on second tab > scroll = gtk.ScrolledWindow() > box = gtk.VBox() > scroll.add_with_viewport(box) > > notebook.append_page(btn, gtk.Label('1st Tab')) > notebook.append_page(scroll, gtk.Label('2nd Tab')) > > win.add(notebook) > > win.show_all() > win.connect('destroy', gtk.main_quit) > > gtk.main() >
Looks like a bit of a bug. A solution you can use is to .hide() the scrolledwindow, add the items you want, and then .show() it again. def add_to_tab2(btn, data=None): scroll.hide() box.pack_start(gtk.Label('Something')) box.pack_start(gtk.HSeparator()) scroll.show_all()
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/