Newbie: Tkinter path type problems (W95)

tom mcdavid tmcdavid at yahoo.com
Sun Sep 19 02:45:55 EDT 1999


Hi:
    I installed Python and Tcl/Tk on a W95 box.  I can't get Tkinter to
work.
Tcl/Tk seems to be installed okay since I can start tclsh and wish.  The
widget demo works fine.   But tkinter has me stumped.  I am not a W95
guru or expert.  Dangerous amateur is more like it.  :-)
I can get Python working okay and have started playing around with the
language.
I have always been successful with
>>>import _tkinter  # and
>>>import Tkinter  #  but when I try
>>>Tkinter._demo()  # I get various problems.  At first it said that it
couldn't find a good
init.tcl in a whole list of locations.  I added some lines to my
autoexec.bat per Lutz and Ascher Learning Python:

SET PATH=D:\PROGRA~1\TCL\bin;%PATH%
set PYTHONPATH=.;d:\PROGRA~1\python\lib;d:\PROGRA~1\python\lib\tkinter
set TCL_LIBRARY=d:\PROGRA~1\tcl\lib\tcl8.0
set TK_LIBRARY=d:\PROGRA~1\tcl\lib\tk8.0

Now when I try the Tkinter._demo(), I get the following stream of
messages:
>>> Tkinter._test()
Traceback (innermost last):
  File "<interactive input>", line 0, in ?
  File "d:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1947, in
_test
    root = Tk()
  File "d:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 886, in
__init__
    self.tk = _tkinter.create(screenName, baseName, className)
TclError: Can't find a usable tk.tcl in the following directories:
    {d:\PROGRA~1\tcl\lib\tk8.0} . d:/PROGRA~1/tcl/lib/tk8.0 ./tk8.0
./lib/tk8.0 ./library ./tk8.0/library ./library
d:/PROGRA~1/tcl/tk8.0/library

d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl: bad event type or keysym "MouseWheel"
bad event type or keysym "MouseWheel"
    while executing
"bind Listbox <MouseWheel> {
    %W yview scroll [expr - (%D / 120) * 4] units
}"
    (file "d:/PROGRA~1/tcl/lib/tk8.0/listbox.tcl" line 179)
    invoked from within
"source [file join $tk_library listbox.tcl]"
    (file "d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl" line 151)
    invoked from within
"source d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $tkfile]"
d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl: bad event type or keysym "MouseWheel"
bad event type or keysym "MouseWheel"
    while executing
"bind Listbox <MouseWheel> {
    %W yview scroll [expr - (%D / 120) * 4] units
}"
    (file "d:/PROGRA~1/tcl/lib/tk8.0/listbox.tcl" line 179)
    invoked from within
"source [file join $tk_library listbox.tcl]"
    (file "d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl" line 151)
    invoked from within
"source d:/PROGRA~1/tcl/lib/tk8.0/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $tkfile]"


This probably means that Tk wasn't installed properly.

note: the line above is the end of the Python error message
How can I get Tkinter to work?

Thanks
Tom McDavid
tmcdavid at yahoo.com






More information about the Python-list mailing list