<br>For a while now, I've noticed test_tcl locking up when trying to refleaktest it. I was able to reproduce it quite simply:<br><br>import Tkinter<br>import os<br><br>if "DISPLAY" in os.environ:<br> del os.environ
["DISPLAY"]<br><br>tcl = Tkinter.Tcl()<br>try:<br> tcl.loadtk()<br>except Exception, e:<br> print e<br>tcl.loadtk()<br><br>Or, more directly, using _tkinter directly:<br><br clear="all">import _tkinter<br>
import os<br><br>if "DISPLAY" in os.environ:<br> del os.environ["DISPLAY"]<br><br>tk = _tkinter.create(None, "test", "Tk", 0, 1, 0)<br>try:<br> tk.loadtk()<br>except:<br> pass
<br>tk.loadtk()<br><br>In either case, the second loadtk never finishes.<br><br>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.)
<br><br><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1475162&group_id=5470&atid=105470">http://sourceforge.net/tracker/index.php?func=detail&aid=1475162&group_id=5470&atid=105470
</a><br><br>-- <br>Thomas Wouters <<a href="mailto:thomas@python.org">thomas@python.org</a>><br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!