[Python-Dev] Tkinter lockups.

Thomas Wouters thomas at python.org
Sun Apr 23 23:36:09 CEST 2006


For a while now, I've noticed test_tcl locking up when trying to refleaktest
it. I was able to reproduce it quite simply:

import Tkinter
import os

if "DISPLAY" in os.environ:
    del os.environ["DISPLAY"]

tcl = Tkinter.Tcl()
try:
    tcl.loadtk()
except Exception, e:
    print e
tcl.loadtk()

Or, more directly, using _tkinter directly:

import _tkinter
import os

if "DISPLAY" in os.environ:
    del os.environ["DISPLAY"]

tk = _tkinter.create(None, "test", "Tk", 0, 1, 0)
try:
    tk.loadtk()
except:
    pass
tk.loadtk()

In either case, the second loadtk never finishes.

It seems that, on my platform at least, Tk_Init() doesn't like being called
twice even when the first call resulted in an error. That's Tcl and Tk
8.4.12. Tkapp_Init() (which is the Tkinter part that calls Tk_Init()) does
its best to guard against calling Tk_Init() twice when the first call was
succesful, but it doesn't remember failure cases. I don't know enough about
Tcl/Tk or Tkinter how this is best handled, but it would be mightily
convenient if it were. ;-) I've created a bugreport on it, and I hope
someone with Tkinter knowledge can step in and fix it. (It looks like SF
auto-assigned it to Martin already, hmm.)

http://sourceforge.net/tracker/index.php?func=detail&aid=1475162&group_id=5470&atid=105470

--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060423/75fd287b/attachment.html 


More information about the Python-Dev mailing list