[pygtk] hide on delete_event()

Frédéric frederic.mantegazza at gbiloba.org
Fri Dec 19 20:11:04 WST 2008


On vendredi 19 décembre 2008, John Finlay wrote:

> >     dialog.connect("destroy", destroy)
>
> You probably mean to connect to the "destroy-event" signal in the above
> though it's not likely that you need to handle it.

The event is called 'delete', and not 'delete-event'...

> >     dialog.destroy()
>
> The above line is what is destroying your dialog - remove it.

Yes, but I need to destroy it once I leave it (but only using a special 
close button, not shown here)...

> You are mixing the two ways of using a dialog - show() and run(). You
> should only use one of these ways. If you use the show() method then add
> a call in delete() to hide() the dialog when you are finished the delete
> processing. If you use the run() method then you don't need to handle
> the delete-event and you should retrieve the return response from the
> run() method to figure out what to do (you also don't need to make the
> dialog modal since run() blocks the UI until it returns).

I forgot to remove the show() call from my previous tests. But it does not 
work neither. As soon as I click on the X dialog, the run() returns. This 
is not what I want. I really want to avoid the dialog to be ended; I want 
to stay in its loop...

-- 
    Frédéric

    http://www.gbiloba.org


More information about the pygtk mailing list