Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python GUI Tkinter错误:self.text=text(self,width=35,height=2,wrap=WORD)TypeError:uu init_uu()获取了意外的关键字参数';包装';_Python_User Interface_Tkinter_Textbox - Fatal编程技术网

Python GUI Tkinter错误:self.text=text(self,width=35,height=2,wrap=WORD)TypeError:uu init_uu()获取了意外的关键字参数';包装';

Python GUI Tkinter错误:self.text=text(self,width=35,height=2,wrap=WORD)TypeError:uu init_uu()获取了意外的关键字参数';包装';,python,user-interface,tkinter,textbox,Python,User Interface,Tkinter,Textbox,当我删除self.text=text(self,width=35,height=2,wrap=WORD)并且该行在另一个程序中运行正常时,我可以让GUI窗口正常打开。但是在我正在处理的主要程序中,我想要一些文本框,我得到了以下错误: self.text=Text(self, width=35, height=2, wrap =WORD) TypeError: __init__() got an unexpected keyword argument 'wrap' 我如何解决这个问题?它在另一个

当我删除
self.text=text(self,width=35,height=2,wrap=WORD)
并且该行在另一个程序中运行正常时,我可以让GUI窗口正常打开。但是在我正在处理的主要程序中,我想要一些文本框,我得到了以下错误:

self.text=Text(self, width=35, height=2, wrap =WORD)
TypeError: __init__() got an unexpected keyword argument 'wrap'

我如何解决这个问题?它在另一个.py文件中运行,因此我认为重新安装python不会有任何帮助,因为您的程序中似乎有其他名为
Text
的类或函数。显然,您没有调用tkinter
Text
类,否则不会出现此错误


注意:如果您将tkinter导入为
将tkinter导入为tk
将tkinter导入为tk
,然后引用前缀为
tk.
(例如:
tk.Text(…)
)的小部件,则不会出现此类问题。这就是通配符导入不好的原因之一。

您的程序中是否有名为
Text
的类?如果我删除参数wrap,它将返回相同的高度错误。不是我定义的类。我使用的是tkinter包,它定义了
文本
检查您的导入,当您调用
文本时,您肯定没有调用tkinter的文本(..
。如果您花时间创建,该练习可能会暴露错误。您正在从某个地方导入的内容覆盖了tkinter小部件的导入。就这样!!使用NBayes nltk包,我想它有一个文本函数。谢谢!