This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkSimpleDialog Window Flashing
Type: Stage:
Components: Tkinter Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Longorh, gpolo, ronLongo
Priority: normal Keywords: patch

Created on 2008-04-15 15:44 by Longorh, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkSimpleDialog.py Longorh, 2008-04-15 15:44
issue_2638.diff gpolo, 2008-07-17 22:34
Messages (7)
msg65519 - (view) Author: Ron Longo Work (Longorh) Date: 2008-04-15 15:44
When a Tkinter window comes up that uses tkSimpleDialog to construct a 
dialog box, the window first flashes on the screen as an unpopulated 
top-level window, before being drawn in its completed state.

This problem is easily corrected by adding two lines of code to the 
constructor for class Dialog in tkSimpleDialog.py.  The first line of 
the constructor reads Toplevel.__init__( self, parent ).  After this 
line insert self.overrideredirect( True ).  The second line from the 
last in this constructor reads self.initial_focus.focus_set(), just 
before this line insert self.overrideredirect( False).  That's it.  
I've attached the revised version of this file.
msg65525 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-04-15 20:01
Isn't overrideredirect only used to enable/disable borders in the window
? Why doing this fix what you described ?
Also, make a patch against python-trunk instead of sending the entire file.
msg69874 - (view) Author: Ron Longo (ronLongo) Date: 2008-07-17 05:40
Correct.  overrideredirect only enables/disables borders.  However, 
what appears as a "flash" when the dialog box first appears is actually 
a window with only borders being drawn (no contents).  Disabling 
borders BEFORE drawing anything prevents this "flash".  I cannot say if 
this "flash" occurs on all platforms, but it does occur on all windows 
XP platforms that I've tried it on.  In each of these cases the "fixed" 
tkSimpleDialog.py prevents this "flash".  While not vital to 
application reliability, this fix does make applications appear more 
professional.
msg69920 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-07-17 22:34
It would be more appropriate to properly use withdraw and deiconify
then. I'm attaching a patch that uses them.
msg69961 - (view) Author: Ron Longo (ronLongo) Date: 2008-07-18 18:00
Excellent!  That solution works as well.
msg78640 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-12-31 17:45
Dropped for inclusion in python 2.5, but should still be considered for
trunk and py3k.
msg83270 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-03-07 02:19
Fixed in r70223 and r70225.

Thanks for reporting.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46890
2009-03-07 02:19:22gpolosetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg83270
versions: - Python 3.0
2008-12-31 17:45:24gpolosetresolution: accepted
messages: + msg78640
versions: + Python 3.0, Python 3.1, Python 2.7, - Python 2.5
2008-07-18 18:00:49ronLongosetmessages: + msg69961
2008-07-17 22:34:47gpolosetfiles: + issue_2638.diff
keywords: + patch
messages: + msg69920
2008-07-17 05:40:22ronLongosetnosy: + ronLongo
messages: + msg69874
2008-04-15 20:01:28gpolosetnosy: + gpolo
messages: + msg65525
2008-04-15 15:44:12Longorhcreate