[pygtk] how to add to a scrolledwindow?
Brian Keck
bwkeck at gmail.com
Sun Jan 2 21:42:04 WST 2011
Hello,
I've written very little pygtk (& no straight gtk), & am stuck trying to
add to a vbox inside a scrolledwindow.
A minimal example is ...
import gtk
window = gtk.Window()
window.connect('destroy', gtk.main_quit)
scrolled = gtk.ScrolledWindow()
window.add(scrolled)
vbox = gtk.VBox()
scrolled.add_with_viewport(vbox)
def addbutton(window, event):
vbox.pack_start(gtk.Button('extra'))
window.show_all
b1 = gtk.Button('aaa')
b1.connect('button_press_event', addbutton)
vbox.pack_start(b1)
b2 = gtk.Button('bbb')
vbox.pack_start(b2)
window.show_all()
gtk.main()
I click 'aaa' but no 'extra' appears.
The actual application starts with a list of book authors as button
labels. Clicking on an author should insert the author's book titles (a
vbox of buttons) between this author & the next. Also, it's for a Nokia
N900 & really uses hildon.PannableArea etc.
Thanks for any help,
Brian Keck
More information about the pygtk
mailing list