【问题标题】:Python Tkinter.py is incorrectPython Tkinter.py 不正确
【发布时间】:2015-07-29 06:39:02
【问题描述】:

嘿,我正在尝试创建一个小测验,但此错误代码不断弹出。 `

Traceback (most recent call last):
  File "Untitled-1.py", line 13, in <module>
    text.config(root, height=50, width=50, state="disabled")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1262, in configure
    return self._configure('configure', cnf, kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1253, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-colormap"
Kestas-iMac:Python scripts jonahfleming$ python Untitled-1.py
Traceback (most recent call last):
  File "Untitled-1.py", line 13, in <module>
    text.config(root, height=50, width=50, state="disabled")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1262, in configure
    return self._configure('configure', cnf, kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1253, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-colormap"

我已尝试解决此问题,但无法对其进行编辑。

【问题讨论】:

  • 您也需要发布代码。

标签: python python-2.7 tkinter


【解决方案1】:

当你重新配置一个 Tkinter 小部件时,你不需要向它发送根对象。

text.config(height=50, width=50, state="disabled")

此外,当您在所使用的库或框架中看到异常时,几乎总是因为您使用不正确,而不是因为框架本身有问题(或“不正确”)。

【讨论】:

    猜你喜欢
    • 2012-02-23
    • 1970-01-01
    • 1970-01-01
    • 2011-06-09
    • 1970-01-01
    • 2016-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多