Why Does My Tkinter Window Sometimes Not Display At All?
Solution 1:
A lot of people have been asking this type of question lately where overrideredirect
is involved. So here is a little longer response as to why it happens and (in this case) how you can potentially fix it. Once you execute the line master.overrideredirect(1)
, window managers don't send focus or other event messages to the window. What might solve your problem is to do master.overrideredirect(1)
at the very end of your initialization. Note also, that once you execute the command, the window manager essentially ignores the window. Try this experiment with master.overrideredirect(1)
and master.overrideredirect(0)
separately. Once the window is rendered, use the <Alt-Tab>
keys to cycle through the windows. Notice that when master.overrideredirect(1)
, the window does not show up in the window list to cycle through. Finally, if the user does <Alt-Tab>
away from the window, there is no event sent to the application to detect this, and the user may have a very difficult time setting focus back on the window, depending on how many overlapping windows they have covering it.
Typically, it is unwise to have a borderless main window due to lack of user control of it. The reason overrideredirect
exists is probably for enabling the creation of custom temporary utility and megawidgets like comboboxes and such.
Post a Comment for "Why Does My Tkinter Window Sometimes Not Display At All?"