|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Glade and GtkComboBoxI found this old post, without answer:
> Hello everyone, I'm new to DaniWeb and a sort of beginner at Python. I've > created a GUI in Python using Glade and GTK and I have two questions. I'm > having trouble with comboboxes. Particularly with entering data into a > combo box from Python. I've tried the following.... > > myCombo = self.wTree.get_widget('comboboxentry') > myCombo.append_text('blah blah blah') > > to no avail... apparently you have to first do gtk.combo_box_new_text() > before you can append text. Is this possible when using Glade to > construct my GUI? Does anybody have a solution to that problem? Thanks, -- Frédéric http://www.gbiloba.org _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
|
Re: Glade and GtkComboBoxI've noticed that problem too. I haven't found any better way to do
it then just using a liststore and doing it the verbose way, which is really just a few more lines of code. On Mon, Jul 14, 2008 at 5:38 AM, Frédéric <frederic.mantegazza@...> wrote: > I found this old post, without answer: > >> Hello everyone, I'm new to DaniWeb and a sort of beginner at Python. I've >> created a GUI in Python using Glade and GTK and I have two questions. I'm >> having trouble with comboboxes. Particularly with entering data into a >> combo box from Python. I've tried the following.... >> >> myCombo = self.wTree.get_widget('comboboxentry') >> myCombo.append_text('blah blah blah') >> >> to no avail... apparently you have to first do gtk.combo_box_new_text() >> before you can append text. Is this possible when using Glade to >> construct my GUI? > > Does anybody have a solution to that problem? > > Thanks, > > -- > Frédéric > > http://www.gbiloba.org > _______________________________________________ > pygtk mailing list pygtk@... > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ > pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
|
Re: Glade and GtkComboBoxOn mardi 15 juillet 2008, Jeremy S wrote:
> I've noticed that problem too. I haven't found any better way to do > it then just using a liststore and doing it the verbose way, which is > really just a few more lines of code. Ok, I've done this, which works fine: listStore = gtk.ListStore(gobject.TYPE_STRING) self.presetTemplateCombobox.set_model(listStore) cell = gtk.CellRendererText() self.presetTemplateCombobox.pack_start(cell, True) #self.presetTemplateCombobox.add_attribute(cell, 'text', 0) i = 0 while True: try: text = config.PRESET_INDEX[i] self.presetTemplateCombobox.append_text(text) i += 1 except KeyError: break What I don't understand is that I must not call add_attribute(). If I do this, the text appears twice on each line. Instead of: Text 1 Text 2 Text 3 I get: Text 1 Text 1 Text 2 Text 2 Text 3 Text 3 I made a very simple test, with only a little dialog and a combobox, and I need to call add_attribute(). But not in my complete application. Any idea why? I checked in glade, and the combobox is defined the exact same way in both cases... -- Frédéric http://www.gbiloba.org _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
| Free Forum Powered by Nabble | Forum Help |