[pygtk] prevent gtk.Dialog from closing

Tasos Latsas tlatsas2000 at gmail.com
Wed Sep 10 02:06:47 WST 2008



Walter Leibbrandt wrote:
> Tasos Latsas wrote:
>> Hello,
>> I have a dialog box which prompts the user for some input with an entry
>> box. I want to be able to check the user input before returning to the
>> main window and show another popup window with a message,
>>  e.g. ("you left the field empty, press cancel button or fill it etc")
>> and then prevent the dialog from closing.
>>
>> I tried to intercept the delete-event but didn't help also i didn't find
>> something similar at the faq
>> Is this possible with a gtk.dialog or i have to use a gtk.window?
>>   
> From
> https://stage.maemo.org/svn/maemo/projects/haf/tags/python-sdk/2.0final/gazpacho-hildon/hildonwidgets/libs.py
> <http://www.google.com/codesearch/url?hl=en&ct=rpc&url=https://stage.maemo.org/svn/maemo/projects/haf/tags/python-sdk/2.0final/gazpacho-hildon/hildonwidgets/libs.py&usg=AFQjCNFsGtCs_UJH8zEP6FmVOGc808Eunw>:
> 
> 
> dialog.window.set_functions(gtk.gdk.FUNC_CLOSE) # see
> http://www.pygtk.org/docs/pygtk/gdk-constants.html#gdk-wm-function-constants
> 
> dialog.window.set_decorations(gtk.gdk.DECOR_ALL) # see
> http://www.pygtk.org/docs/pygtk/gdk-constants.html#gdk-wm-decoration-constants
> 
> 
> 
> With the right parameters you should get the effect you're looking for.
> 
> But I would like to urge you to reconsider altering this. From a UI
> design point-of-view, closing a dialog should be enough of a response
> from the user (ie. the same as if he hit "Cancel"). Make sure that you
> want to break this convention before doing so.
> 
> Regards,
> 
> Walter
> 

Ok thank you, I'm already reconsidering this..
Unfortunately I don't know much about SW Engineering


More information about the pygtk mailing list