python 调用super()初始化报错“TypeError: super() takes at least 1 argument”
来源:互联网 发布:淘宝网咖啡杯 编辑:程序博客网 时间:2024/06/03 18:03
原本代码是这样的:
class Application(tk.Tk): def __init__(self): '''初始化''' super().__init__() # 有点相当于tk.Tk()但这是python3的用法,在python2.7中必然报错
解决方法如下:
class Application(tk.Tk): def __init__(self): '''初始化''' tk.Tk.__init__(self) # 有点相当于tk.Tk()
还有一种解决方案如下: (这种方法对父类有一定要求,不一定能成功)class Application(father): def __init__(self): super(Application, self).__init__()
阅读全文
0 0
- python 调用super()初始化报错“TypeError: super() takes at least 1 argument”
- python 调用super()初始化报错“TypeError: super() takes at least 1 argument”
- Python 调用super初始化报错 "super() argument 1 must be type, not classobj"
- Python 调用super初始化报错 "super() argument 1 must be type, not classobj"
- Python: TypeError: XXX() takes exactly 1 argument (2 given)
- TypeError: __init__() takes at least 4 arguments (4 given)
- TypeError: resize_images() takes at least 3 arguments (3 given)
- python报错 TypeError: object() takes no parameters
- PamIE 和COM调用IE出错: TypeError: getElementById() takes exactly 1 argument (2 given)
- super() fails with error: TypeError “argument 1 must be type, not classobj”
- PAMIE TypeError: getElementsByTagName() takes exactly 1 positional argument (2 given)
- TypeError: checkcode() takes exactly 1 argument (2 given)
- super init的初始化调用
- python2.7 使用super关键词 报错 TypeError: must be type, not classobj 解决办法
- Python 'takes exactly 1 argument (2 given)' Python error
- Python 'takes exactly 1 argument (2 given)' Python error
- python出现super.__init__:TypeError:must be type,not classobj
- django中报错TypeError: su() takes exactly 1 argument (2 given)的解决办法
- 【置顶】最大连续子数组
- MySQL PXC GTID
- vultr的VPS安装BBR
- HashMap实现原理
- 利用spring aop拦截并获取@ResponseBody数据
- python 调用super()初始化报错“TypeError: super() takes at least 1 argument”
- Java中CAS详解
- Windows程序设计-输出文字
- VC6.0新建工程——Win32 Application和Win32 Console Application
- 在java项目中打印sql语句日志
- SQL 与MYSQL与SQL SERVER与ORACLE的关系
- MAC 10.12系统环境下无法打开360加固助手的解决
- TouchEvent
- 回溯算法与分支限界法