[英]Tkinter Class “must be str not tuple” TypeError Python
I'm getting a problem with Tkinter for python, I have a class, application(root):
root is Tk(), and when I run the class without an __init__
function, it works okay, but crashes after I quit the program. 我在使用Tkinter for python时遇到问题,我有一个类,
application(root):
根是Tk(),当我在没有__init__
函数的情况下运行该类时,它可以正常工作,但是在退出程序后崩溃。 With the __init__
, Tkinter tells me 用
__init__
,Tkinter告诉我
Traceback (most recent call last):
File "C:\stuff\Portable Python 3.2.0.1\application.pyw", line 75, in <module>
class application(root):
File "C:\Python32\lib\tkinter\__init__.py", line 1674, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
TypeError: must be str, not tuple
Which doesn't make sense to me, I never gave it a tuple. 这对我来说没有意义,我从来没有给它一个元组。 I'm sorry if this is a very idiot question, I tried googling it and came up with nothing.
很抱歉,如果这是一个非常愚蠢的问题,我尝试使用Google进行搜索,但一无所获。 Thanks.
谢谢。
root
is the base class for application
. root
是application
的基类。 You have provided an instance of Tk
as the base class, rather than the class itself, ie application(Tk)
. 您提供了
Tk
的实例作为基类,而不是类本身,即application(Tk)
。
It would help if you could show a simple example of your failing code. 如果您可以显示失败代码的简单示例,则将有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.