python出现这个错误

软件和网站开发以及相关技术探讨
回复
头像
Ragingflames
帖子: 89
注册时间: 2006-09-08 19:59

python出现这个错误

#1

帖子 Ragingflames » 2008-09-25 21:11

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()
ALC655 SB450的声卡的福音请去我帖子

http://forum.ubuntu.org.cn/viewtopic.ph ... highlight=
头像
mghohoo
帖子: 364
注册时间: 2008-07-13 18:29
来自: 广州

Re: python出现这个错误

#2

帖子 mghohoo » 2008-09-25 21:19

like this?
def __init__(self,title,width,height):
笔记本:Acer 3820tg
台式机:
CPU:Intel E-1230V
内存:32GB RAM
显卡:660GTX
硬盘:INTEL 730 480G
头像
Ragingflames
帖子: 89
注册时间: 2006-09-08 19:59

Re: python出现这个错误

#3

帖子 Ragingflames » 2008-09-25 21:43

谢谢
还是不行
ALC655 SB450的声卡的福音请去我帖子

http://forum.ubuntu.org.cn/viewtopic.ph ... highlight=
头像
jarlyyn
帖子: 4671
注册时间: 2006-04-12 18:54
联系:

Re: python出现这个错误

#4

帖子 jarlyyn » 2008-09-27 13:31

应该就是2楼的问题,两边各2个_,不是一个
头像
hecha
帖子: 364
注册时间: 2007-09-23 13:36

Re: python出现这个错误

#5

帖子 hecha » 2008-09-27 13:34

缩进了没有?
头像
Ragingflames
帖子: 89
注册时间: 2006-09-08 19:59

Re: python出现这个错误

#6

帖子 Ragingflames » 2008-09-28 11:31

谢谢2楼的帮我解决问题
谢谢4楼的关注
ALC655 SB450的声卡的福音请去我帖子

http://forum.ubuntu.org.cn/viewtopic.ph ... highlight=
回复