[Tkinter-discuss] withdraw() not working when changing virtual desktop

Michael Lange klappnase at web.de
Sat Dec 5 20:54:28 CET 2009

Hi all,

I encountered a strange problem here; the system is debian linux,
it happens both with python-2.5.2 and with python-2.4.6 with tk-8.4.19
as well as with tk-8.5.3; I tried a few different WMs, I can only
reproduce the bug with IceWM (1.2.35), on KDE and XFCE it did not occur.

The problem is, that withdraw() does not work when the window in
question is on another virtual desktop than the currently active.
This is annoying if there is for example a dialog window with a
progress bar that shows the progress of a process that takes some time,
and when the process has finished the dialog should automatically
disappear; if the user switches to another desktop while the process is
running the dialog stays on the screen. The simplest code to exhibit
the bug is something like:

from Tkinter import *
root = Tk()
top = Toplevel()
def test():
    root.after(5000, top.withdraw)
b = Button(root, text='test', command=test)
b.pack(padx=100, pady=100)

When I press the button and then switch to another desktop the toplevel
is not withdrawn.
Has anyone ever heard about this, is this only a bug in IceWM and is
there a possible workaround ?



More information about the Tkinter-discuss mailing list