|
|
||||||||||||||||||||||||
|
Tkinter TroubleshootingWindows gotchasStarting with Python 1.5.2 beta 1, the Tcl/Tk installer is included by in the Python installer, and (if you leave the checkbox checked) automatically run at the end of the Python installation. On Windows 95 and 98, you have to edit autoexec.bat after installing Tcl/Tk to ensure that the TCL/TK DLLs can be found; see the download instructions for details. If you had an older version of Tcl/Tk installed and have now upgraded to 8.0.4 or later, you may get an error message about the <MouseWheel> event. This means that the old (8.0.3 or older) Tcl/Tk DLLs are used with the new Tcl/Tk scripts. Track down the old DLLs and throw them away, or copy the new ones (from C:\Program Files\Tcl\bin) on top of them. Don't use Tcl/Tk versions before 8.0, they are flakey. Tkinter currently doesn't work under PythonWin (Mark Hammond's interactive Python development environment). It does work with the MS-DOS console version (python.exe) and with the console-free version (pythonw.exe). The systematic checking procedure given below is also helpful. (You may still find Michael Ryan's web page Installing Python/Tkinter on Windows 95 useful, even though it is geared towards Python 1.4, when the process was much less smooth.) Macintosh gotchasThe Mac installation is pretty smooth, as long as you have recent system software and enough memory, and it automatically installs Tcl/Tk for you, so you don't have to do anything. Don't use older Tcl/Tk versions than 8.0, they are flakey. The systematic checking procedure given below is also helpful. Unix gotchasOn Unix, a number of common problems occur. A common configuration problem is to have header files tcl.h or tk.h installed (often in /usr/local/include) that don't match the library files, libtcl<version>.a and libtk<version>.a (or similar names ending in .so), often in /usr/local/lib. This often results in unsatisfied references at link time or even at import time (when Tcl/Tk themselves are shared libraries). Locate the files and compare the version numbers in tcl.h/tk.h (search for TCL_VERSION and TK_VERSION) to the library version numbers. Also note that before Tcl/Tk 8.0, "matching" Tcl/Tk versions were 7.5/4.1 and 7.6/4.2. Use the systematic checking procedure below to check your installation. Checking your Tkinter supportA good way to systematically check whether your Tkinter support is working is the following. Enter an interactive Python interpreter in a shell on an X console. Step 1 - can _tkinter be imported?Try the following command at the Python prompt: >>> import _tkinter # with underscore, and lowercase 't'
Step 2 - can Tkinter be imported?Try the following command at the Python prompt: >>> import Tkinter # no underscore, uppercase 'T'
Step 3 - does Tkinter work?Try the following command at the Python prompt: >>> Tkinter._test() # note underscore in _test()
|