shawn bright escribió:

i am using a gtk ComboBoxEntry with the convenience methods, like insert_text, append_text, and so forth. Is there a way i can get a list of all of the stuff my script has put in there, and especially, is there a way to clear it out and start with a blank ComboBoxEntry ?

Hi,

I think the tutorial covers that... anyway, you have a detailed explanation at
the official reference:

http://www.pygtk.org/pygtk2reference/class-gtkcombobox.html

with the combo you have an associated gtk.TreeModel (you can obtain it calling
get_model() method):

http://www.pygtk.org/pygtk2reference/class-gtktreemodel.html

you'll see there how to get values, delete them and so on.

Simple example that creates a ComboBoxEntry with two options, prints their
values and then clears the model:

w = gtk.Window()
combo = gtk.combo_box_entry_new_text()
w.add(combo)
combo.append_text("option1")
combo.append_text("option2")
model = combo.get_model()
iter = model.get_iter_first()
while iter:
    print "value:", model.get_value(iter, 0)
    iter = model.iter_next(iter)
model.clear()
w.show_all()
gtk.main()

arnau

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to