TKinter and multiprocessing in GNU/Linux/X

Weeble clockworksaint at
Sun Jan 4 18:26:51 CET 2009

I'm using the multiprocessing module in Python 2.6 to run a pygame
application. When errors occur, I create a new Process with the
multiprocessing module and have it display a TKinter dialog. The
pygame application can carry on happily without waiting for the
dialog. This works fine on Windows. However, I've just tried the same
code on Linux, and the TKinter dialog never appears. The process is
spawned - if I print from it then it still appears on the console, but
it does not display any TKinter window. If I create a TKinter window
in my main process it works okay.

I have a feeling that on Linux the multiprocessing module is doing a
fork and all of the subprocesses end up fighting over the same
connection to the X-server, is this possible? If so, is there some way
to get multiprocessing to create a more "independent" process like on
Windows? Or is there some way to tell TKinter to create a new
connection to the X-server?

I posted this as a question on Stack Overflow already, and there I've
included source code to demonstrate what I'm doing:

More information about the Python-list mailing list