_tkinter.TclError:无效的命令名称“labelframe”
运行我编写的 python/tkinter
GUI 应用程序时出现以下错误。
我认为这可能是 Tcl/Tk 版本问题,但 Tcl/Tk 8.4(这是我正在使用的版本)中添加了 LabelFrame()
命令。
我尝试在其上执行程序的另一台计算机能够运行我编写的另一个 python/tkinter
应用程序 - 应用程序之间的区别在于应用程序使用 LabelFrame()
code> widget 而另一个则没有。
Traceback (most recent call last):
File "/home/nharris/python/isub_parser/isub.py", line 672, in <module>
timeFrame = LabelFrame(optFrame, text="Time Scale Options")
File "/usr/apps/Python/python2.6.1-rhel3-i686/lib/python2.6/lib-tk/Tkinter.py", line 3525, in __init__
Widget.__init__(self, master, 'labelframe', cnf, kw)
File "/usr/apps/Python/python2.6.1-rhel3-i686/lib/python2.6/lib-tk/Tkinter.py", line 1932, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: invalid command name "labelframe"
I'm getting the following error when running a python/tkinter
GUI application I wrote.
I thought it could be a Tcl/Tk version issue, but the LabelFrame()
command was added in Tcl/Tk 8.4, (which is the version I am using).
The other computer that I am attempting to execute the program on is able to run another python/tkinter
application I wrote--the difference between the applications is that one utilizes the LabelFrame()
widget and the other does not.
Traceback (most recent call last):
File "/home/nharris/python/isub_parser/isub.py", line 672, in <module>
timeFrame = LabelFrame(optFrame, text="Time Scale Options")
File "/usr/apps/Python/python2.6.1-rhel3-i686/lib/python2.6/lib-tk/Tkinter.py", line 3525, in __init__
Widget.__init__(self, master, 'labelframe', cnf, kw)
File "/usr/apps/Python/python2.6.1-rhel3-i686/lib/python2.6/lib-tk/Tkinter.py", line 1932, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: invalid command name "labelframe"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
python 可能使用它自己的特殊版本的 TCL/TK,具体取决于它的构建和安装方式。 Windows 上通常是这种情况,Linux 上有时会出现这种情况,MacOS X 上很少出现这种情况。您必须依靠 python 内部报告的版本来知道它正在使用什么版本。
如果 python 没有使用已安装的版本(正如您遇到的情况),您可以尝试更新 python。如果在您的 Linux 发行版上,您无法克服使用可用软件包构建 python 的方式,则必须从源代码构建 python 以使用较新版本的 TCL/TK 或使用已安装的版本。
python may be using its own special version of TCL/TK, depending on how it was built and installed. This is usually the case on on windows, sometimes the case on linux, and seldom the case on MacOS X. You must rely on the version reported inside python to know what version it is using.
If python is not using the installed version (as is the case you are experiencing), you can try updating python. If, on your distribution of linux, you cannot overcome the way python was built using available packages, you will have to build python from source to use a newer version of TCL/TK or to use the installed version.
使用这两种方法可以报告两个不同版本的 Tcl/Tk:
Tcl/Tk 的更新应该修复它。
It is possible to get two different versions of Tcl/Tk reported using these two methods:
An update of Tcl/Tk should fix it.