python - How do I add items to a gtk.ComboBox created through glade at runtime? -


I am using Glade 3 to create a GtkBuilder file for a PyGTK app on which I am working . This is for management of bandwidth, so I have gtk.ComboBox to select the network interface to track.

How do I add a combo box to the string over runtime? This is what I have done so far:

  self.tracked_interface = builder.get_object ("tracked_interface") self.iface_list_store = gtk.ListStore (gobject.TYPE_STRING) self.iface_list_store.append ([ "Hello,"] self.iface_list_store.append (["world."] Self.tracked_interface.set_model (self.iface_list_store) self.tracked_interface.set_active (0)  

but combobox Remains empty

Cheers.

Or you can simply create and insert a combo box using it yourself. After that, you will be able to use gtk shortcuts for text, and text. Combo = gtk.combo_box_new_text () combo.append_text ('hello') combo.append_text combo (.set_active (0) box = builder .get_object ('some box') Box.pack_start (combo, false, false)


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -