[pygtk] prevent gtk.Dialog from closing
walter at translate.org.za
Tue Sep 9 19:48:12 WST 2008
Tasos Latsas wrote:
> 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?
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.
Walter Leibbrandt http://translate.org.za/blogs/walter
Software Developer +27 12 460 1095 (w)
* The first official release of Spelt
* Auto-completion and auto-correction for Gtk+ widgets
* Gtk+ Tip of the Day: Modifying the subject of an event being processed
More information about the pygtk