gpt4 book ai didi

python - Tkinter TclError 找不到包 Tix

转载 作者:太空宇宙 更新时间:2023-11-04 03:38:31 27 4
gpt4 key购买 nike

这个问题类似于this other question .

当我在 Mac OS X 上运行以下代码时(它在 Windows 上运行良好):

import Tix 
root = Tix.Tk()

我收到以下错误消息:

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tix.py", line 221, in init self.tk.eval('package require Tix') _tkinter.TclError: can't find package Tix

Python 文档描述了 issue ,但下面的答案对我没有帮助:

If this fails, you have a Tk installation problem which must be resolved before proceeding. Use the environment variable TIX_LIBRARY to point to the installed Tix library directory, and make sure you have the dynamic object library (tix8183.dll or libtix8183.so) in the same directory that contains your Tk dynamic object library (tk8183.dll or libtk8183.so). The directory with the dynamic object library should also have a file called pkgIndex.tcl (case sensitive), which contains the line:

package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]

如果有人遇到此错误并找到解决方法,请告诉我。

最佳答案

基于 Terry 对 Python.org 用户组的询问:

  1. 如果您使用的是 64 位 Mac OSX,那您就不太走运了。

  2. 如果您碰巧有 32 位运行并且安装了 Tcl,您可以简单地使用 teacup 安装 Tix(它是类似于 pip 并且它随 Tcl) 一起安装

    sudo teacup install Tix

  3. Tix 过时(小部件样式和文档维护),最好使用 Ttk .

关于python - Tkinter TclError 找不到包 Tix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27751923/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com