Walter Leibbrandt schrieb: > The *_text() methods are only applicable if the ComboBox was created > with gtk.combo_box_new_text() or gtk.combo_box_entry_new_text(). If the > ComboBox was created in another way (such as in Glade), you have to > initialize it yourself: > > def create_combo_with_items(items): > combo = gtk.ComboBox() > ls = gtk.ListStore(str) > for i in items: > ls.append([str(i)]) > combo.set_model(ls) > cellr = gtk.CellRendererText() > combo.pack_start(cellr) > combo.add_attribute(cellr, 'text', 0) > return combo
Uhh, that's a whole lot of pain for such a simple thing as changing the items in a combobox. Especially since I do not only need to create the combobox, I also need to place it in my window and make it visible. I really like the idea of having a XML-GUI definition and loading it at runtime. Why is it such a hassle to perform this easy task? I'd have thought that something along the lines of combobox.items = [ "foo", "bar ] exists (that somewhat resembles the Delphi syntax for handling comboboxes which I liked very much). Is there no easier way than manually creating the combobox at runtime? Can I somehow convince Glade to create a combobox in the variant you presented? Thanks for your help, Kind regards, Johannes _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
