开发者

_tkinter.TclError: invalid command name "labelframe"

开发者 https://www.devze.com 2023-01-26 04:12 出处:网络
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 t

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 开发者_StackOverflow中文版+ self._options(cnf))
_tkinter.TclError: invalid command name "labelframe"


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.


It is possible to get two different versions of Tcl/Tk reported using these two methods:

Method 1:
>tclsh
%info patchlevel
8.4.15

Method 2:
>python
>>>import Tkinter;print Tkinter.TkVersion
8.3

Key: 
> default command line
>>> python command line
% tcl command line

An update of Tcl/Tk should fix it.

0

精彩评论

暂无评论...
验证码 换一张
取 消