the simple way:
#create a new empty combobox
combo_box = gtk.combo_box_new_text()
items = ["Item 1", "Item 2" ......]
for item in items:
combo_box.append_text(item)
#we need to know the name of the container we are putting the combobox in
#In this case I have set the name of the gtk.HBox in glade to
"combo_container"
self.wTree.get_widget("combo_container").pack_start(combo_box)
#set the 1st item as selected
combo_box.set_active(0)
combo_box.show()
These are the methods you can use to add and remove text:
append_text(text)
prepend_text(text)
insert_text(index, text)
remove_text(index, text)
To see what is currently selected we can use:
group_box.get_active_text()
There is another way of creating combo boxes, but its a bit more involved, I
think this is suitable for most situations.
Regards,
Daniel Woodhouse
On Wed, Jul 8, 2009 at 8:58 AM, surabhi dwivedi <
[email protected]> wrote:
> Hello
>
> I am very new to glade/GTK/Python. I have designed a page using GLADE and
> that I am running using python , I want to add a combo box in that and
> execute that at run time .Can you help me how should I proceed.
>
> Thanks and Regards
>
> <http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline....@middle?>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/