我从tkinter.Text()
收到此错误:
>>> import tkinter
>>> tkinter.Text()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/tkinter/__init__.py", line 3095, in __init__
Widget.__init__(self, master, 'text', cnf, kw)
File "/usr/lib/python3.6/tkinter/__init__.py", line 2293, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: expected integer but got "sans"
甚至tkinter._test()
:
>>> tkinter._test()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/tkinter/__init__.py", line 3985, in _test
label = Label(root, text=text)
File "/usr/lib/python3.6/tkinter/__init__.py", line 2760, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/usr/lib/python3.6/tkinter/__init__.py", line 2293, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: expected integer but got "sans"
信息很清楚,但我不知道从哪里开始。
编辑:当我尝试使用matplotlib.pyplot.plot()
时出现此错误。但matplotlib
this已成功(不再出错)tkinter
。我没有找到类似处理Need help to send mail `(smtp.gmail.com)` through proxy settings.
Not working even after trying multiple libraries (Including socks)
Latest - Using `xsmtplib`.. but getting following error.
The HTTP proxy server may not be supported by PySocks (must be a CONNECT tunnel proxy)
的方法。
答案 0 :(得分:0)
使用相同的代码我没有得到任何错误,所以我无法调试它。因此,我认为您应该尝试以下操作:
from tkinter import *
root=Tk()
log = Text(root, state='disabled', width=80, height=24, wrap='none')
log.grid()
root.mainloop()
如果它不起作用,而其他小部件(如按钮和条目)不起作用,则说明您安装的tkinter出现问题。因此,尝试解除安装,然后重新安装tkinter:
sudo apt-get remove python3-tk
sudo apt-get install python3-tk
如果以上给出了错误,请使用此链接检查您的linux版本,以及如何执行此操作(另请参见注释): Install tkinter for Python
尝试一下,让我知道是否有帮助。