[pygtk] Confirm exit dialog
Braulio Ríos
braulioriosf at gmail.com
Sat Nov 15 03:32:09 WST 2008
Researching more and more I discovered that all you have to do, is the
following:
window = gtk.Window()
window.connect('delete_event', hide)
def hide(widget, signal):
widget.hide()
return True
The key is that when you call the connect method, it connects this function
before the default class signal handlers, and if the function returns True,
the other handlers won't be called. If the handler doesn't return anything,
or False, then all the following handlers will be called, for example, the
destroy function which destroys the window, casually.
On Fri, Nov 14, 2008 at 4:10 PM, Braulio RÃos <braulioriosf en gmail.com>wrote:
> Ok, I've been researching a little more and I found out a magical function
> called hide_on_delete which you have to connect to the destroy_event in the
> desired window.
> For example:
>
> window = gtk.Window()
> window.connect('destroy_event', window.hide_on_delete)
>
> And it seems as if this function removes the default function linked to the
> window which destroys the window, and calls the hide() method of the window
> instead.
>
>
> On Fri, Nov 14, 2008 at 3:38 PM, Braulio RÃos <braulioriosf en gmail.com>wrote:
>
>> Hi everybody,
>> I'd like to know if there is any way to replace the destroy action over a
>> window when you press the close button by another event, for example, just
>> hiding it instead of destroying it, or show a confirm exit dialog before
>> closing.
>> Thanks!
>>
>> --
>> Lampar
>>
>> Mudanza de blog en curso...
>>
>
>
>
> --
> Lampar
>
> Mudanza de blog en curso...
>
--
Lampar
Mudanza de blog en curso...
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20081114/7e4edc91/attachment.htm
More information about the pygtk
mailing list