Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to implement a drop down list in an Ubuntu app using Glade (GTK+3) and Python. I can get the ComboBoxText to display, populated with strings. However when I close the window it is contained in and then re-open it, the combobox is not there, just a completely blank window.

I added the ComboBoxText widget in question to a window in Glade. I then added this code in my Python programme:

def on_button_edit_clicked(self, widget):
    """ display list of events already stored, and allow deletion """   

    self.combo = self.builder.get_object('combo_box') = Gtk.ListStore(str)['hello'])['goodbye'])

   event_editor = self.builder.get_object("event_editor") 

I even tried destroying the widget to see if that helps:

def on_event_editor_destroy(self, widget):
    self.combo.destroy() = Gtk.ListStore(str)


I have since tried some alternative code, that included a CellRendererText object, but still no luck.

These are my sources (unfortunately I can't link to them all as I don't have enough of a reputation):

I created a Gtk.ListStore(), then I created a Gtk.CellRendererText(), then I created a Gtk.ComboBox(). This was all in-line with example 13.3 here.

Nothing works. When I open the combobox window a 2nd time, it is just a blank window. Can anyone help please?

share|improve this question
You could try to ask such question since it is programming oriented at Stack Overflow. Also check this " for more information. A quick reminders, did you check if 'combo_box' is the name for the combobox used in Glade? Did you added it in the layout manager? – Stef K Apr 15 '13 at 22:43
Hi Stef, I already asked on Stackoverflow, no response :( – Jon Hudson Apr 15 '13 at 23:35
Where is the "layout manager" you speak of? – Jon Hudson Apr 15 '13 at 23:36
You can check here about layout manager which is responsible for placing widgets on a window. – Stef K Apr 16 '13 at 12:08
How are you calling the combobox window? Are you instantiating a new class each time or using show, hide methods? Can you post more code? – Ian B. Apr 18 '13 at 14:34

The problem lies with the Window.

You should implement a callback for the 'delete-event' signal of the Window widget.

def on_event_editor_delete_event(self, widget, event):
    return True

This callback hides the Window and returns True so the event isn't propagated further (i.e. the Window isn't destroyed, including your ComboBox).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.