Andy Zhou
Andy Zhou

Reputation: 182

Tkinter Package doesn't work well on pypy3(Windows 10)

Recently, I installed pypy3.6 on my computer. I tried to run tkinter like this:

Python 3.6.9 (1608da62bfc7, Dec 23 2019, 12:38:24)
[PyPy 7.3.0 with MSC v.1911 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import tkinter
>>>> root = tkinter.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\pypy3.6\lib-python\3\tkinter\__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
  File "D:\pypy3.6\lib_pypy\_tkinter\__init__.py", line 31, in create
    interactive, wantobjects, wantTk, sync, use)
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 157, in __new__
    Tcl_AppInit(self)
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 49, in Tcl_AppInit
    app.raiseTclError()
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 171, in raiseTclError
    tklib.Tcl_GetStringResult(self.interp)).decode('utf-8'))
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    D:/pypy3.6/lib_pypy/lib/tcl8.5 D:/lib/tcl8.5 D:/lib/tcl8.5 D:/library D:/library D:/tcl8.5.2/library D:/tcl8.5.2/library

This probably means that Tcl wasn't installed properly.

My Environment Variable(part) Environment Variable For Pypy3

When I tried on my CPython 3.8.1, it worked well.

Upvotes: 0

Views: 480

Answers (1)

mattip
mattip

Reputation: 2563

I think the d:\pypy3.6\tcl\tcl8.5 library should be renamed to d:\pypy3.6\lib\tcl and d:\pypy3.6\tcl\tk8.5 renamed to d:\pypy3.6\lib\tk. If you do that does it solve the problem?

This was an issue with the pypy zipfile. It was fixed and will be part of the next release.

Upvotes: 2

Related Questions