Traceback (most recent call last):
File "./windows2.py", line 13, in <module>
window=MyWindow('PyGTK',300,200)
TypeError: this constructor takes no arguments
#!/usr/bin/env python
import gtk
import pygtk
pygtk.require('2.0')
class MyWindow():
def _init_(self,title,width,height):
self.window=gtk.Window()
self.window=set_title(title)
self.window=set_default_size(width,height)
self.window.show()
def main(self):
gtk.main()
window=MyWindow('PyGTK',300,200)
window.main()
python出现这个错误
- Ragingflames
- 帖子: 89
- 注册时间: 2006-09-08 19:59
- mghohoo
- 帖子: 364
- 注册时间: 2008-07-13 18:29
- 来自: 广州
Re: python出现这个错误
like this?
def __init__(self,title,width,height):
def __init__(self,title,width,height):
笔记本:Acer 3820tg
台式机:
CPU:Intel E-1230V
内存:32GB RAM
显卡:660GTX
硬盘:INTEL 730 480G
台式机:
CPU:Intel E-1230V
内存:32GB RAM
显卡:660GTX
硬盘:INTEL 730 480G
- Ragingflames
- 帖子: 89
- 注册时间: 2006-09-08 19:59
Re: python出现这个错误
谢谢
还是不行
还是不行
- jarlyyn
- 帖子: 4671
- 注册时间: 2006-04-12 18:54
- 联系:
- hecha
- 帖子: 364
- 注册时间: 2007-09-23 13:36
Re: python出现这个错误
缩进了没有?
- Ragingflames
- 帖子: 89
- 注册时间: 2006-09-08 19:59
Re: python出现这个错误
谢谢2楼的帮我解决问题
谢谢4楼的关注
谢谢4楼的关注