]> granicus.if.org Git - python/commitdiff
Fixed issue #2638: Show a window constructed with tkSimpleDialog.Dialog only
authorGuilherme Polo <ggpolo@gmail.com>
Sat, 7 Mar 2009 02:14:38 +0000 (02:14 +0000)
committerGuilherme Polo <ggpolo@gmail.com>
Sat, 7 Mar 2009 02:14:38 +0000 (02:14 +0000)
after it is has been populated and properly configured in order to prevent
window flashing.

Lib/lib-tk/tkSimpleDialog.py
Misc/NEWS

index 6948a49325c9d2230b27ef46c95f74eae1dea107..8c583db8be7b57c1ac2cf0dea8324bed2b5bd678 100644 (file)
@@ -46,6 +46,7 @@ class Dialog(Toplevel):
         '''
         Toplevel.__init__(self, parent)
 
+        self.withdraw() # remain invisible for now
         # If the master is not viewable, don't
         # make the child transient, or else it
         # would be opened withdrawn
@@ -65,8 +66,6 @@ class Dialog(Toplevel):
 
         self.buttonbox()
 
-        self.wait_visibility() # window needs to be visible for the grab
-        self.grab_set()
 
         if not self.initial_focus:
             self.initial_focus = self
@@ -77,8 +76,13 @@ class Dialog(Toplevel):
             self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
                                       parent.winfo_rooty()+50))
 
+        self.deiconify() # become visibile now
+
         self.initial_focus.focus_set()
 
+        # wait for window to appear on screen before calling grab_set
+        self.wait_visibility()
+        self.grab_set()
         self.wait_window(self)
 
     def destroy(self):
index 1eec608cc6b0b3481868d065dcd693470b2190c2..d7be33181da88c4a452fe5712bf4ad694a5756cb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -168,6 +168,10 @@ Core and Builtins
 Library
 -------
 
+- Issue #2638: Show a window constructed with tkSimpleDialog.Dialog only after
+  it is has been populated and properly configured in order to prevent
+  window flashing.
+
 - Issue #4792: Prevent a segfault in _tkinter by using the
   guaranteed to be safe interp argument given to the PythonCmd in place of
   the Tcl interpreter taken from a PythonCmd_ClientData.