delete-event cannot be caught

Asked by guarini

I am trying to catch the delete-event signal from a dialog box.
I currently have the followign code but this does not work as expected

def on_about_delete_event(widget, data, wtree):
    return True

now this code should work but does not and I think it may be related with how gladex does it's magik

do you have any suggestions or am I missing something here?


Question information

English Edit question
Gladex Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Christopher Pax (paxmanchris) said :

The code you have is not the way you want to handle a dialog.

Take a good look at the code for the calculator example in the examples file. Look for the function on_about_dialog_activate in the calculator_callbacks file.

def on_about_dialog_activate(widget, data, wtree):
 about = wtree.get_widget("aboutdialog1")
 responce =
 if responce == gtk.RESPONSE_CANCEL or responce==gtk.RESPONSE_DELETE_EVENT:

This function is called when a button is pressed (open the calculator glade file to see this). The gtk dialog returns a response id, which is really just a number. You then take that number and match it to one of the gtk constance (

Hope this helps you.

Revision history for this message
guarini (jguarini) said :

not wanting to use the run() that example did not help.

I ended up creating the widget myself then hiding/showing at will.

thanks for your response

btw I appreciate the work that goes into this app, it's very handy

Revision history for this message
Christopher Pax (paxmanchris) said :

And thank you for using it. Up until now we had no idea that there are people using are program.

So. Fear not to ask us any question or report any bugs.

If you have any suggestions or comments, please let us know.
you can email us: just check out the AUTHORS file for email.
or you can register a blueprint (where you can define a new feature you want in the program or plugin).

Thanks once again.

Revision history for this message
guarini (jguarini) said :

one note: I had made a couple of changes since for some reason the app
was having issues finding in the current dir

basically I changed the following self.gladefile =


self.gladefile = os.path.split(__file__)[0]+'/'

did that in a few other files/places as well. If you would like I can
post a diff


Revision history for this message
Charles Edward Pax (pax) said :

I reported your your last comment as a bug #129355 ( Let's move the conversation there. Question marked as solved.