Frédéric wrote:
> 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'...
>   
Check the docs for the gtk.Widget to see the signals:
http://pygtk.org/docs/pygtk/class-gtkwidget.html#signal-prototypes-gtkwidget

Both "delete-event" and "destroy-event" are Widget signals. "destroy" is 
a gtk.Object signal.
>>>     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...
>   
Then don't use run(), connect a callback to the "response" signal and 
put all the dialog processing in that. You still need to handle the 
"delete-event" signal to prevent the dialog closing and put the 
destroy() in the "response" signal handler assuming the close button is 
part of the dialog; if not then put it in the button's "clicked" handler.

John
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to