2004年08月21日 星期六 17:28
我新建了一个testbutton类,继承自gtk.Button,可是为什么只能实例化一个对象?
#!/usr/bin/python
import gtk
class testbutton(gtk.Button):
def button_press(self, widget, event):
if event.type == gtk.gdk._2BUTTON_PRESS:
self.destroy()
return gtk.TRUE
return gtk.FALSE
def __init__(self,text):
apply(gtk.Button.__init__,(self,text))
self.set_label(text)
self.connect_object("event", self.button_press,None)
window=gtk.Window(gtk.WINDOW_TOPLEVEL)
hbox=gtk.HBox()
hbox.show()
testbutton=testbutton("test0")
testbutton.show()
hbox.pack_start(testbutton,gtk.TRUE,gtk.TRUE,0)
testbutton=testbutton("test1")
testbutton.show()
hbox.pack_start(testbutton,gtk.TRUE,gtk.TRUE,0)
window.connect("destroy",lambda w: gtk.main_quit())
window.add(hbox)
window.show()
gtk.main()
===================================================
飞骋邮局--纯免费飞骋邮局88M空间30M附件及10M存储
飞骋邮局--追求高效稳定的专业大容量邮箱 www.fc18.com
2004年08月21日 星期六 17:45
On 2004-08-21 17:28:1093080486 +0800, 宋宽 wrote:
> 我新建了一个testbutton类,继承自gtk.Button,可是为什么只能实例化一个对象?
>
> #!/usr/bin/python
>
> import gtk
>
> class testbutton(gtk.Button):
> ...
> hbox.show()
> testbutton=testbutton("test0")
用变量 testbutton 代替了类 testbutton
> testbutton.show()
> hbox.pack_start(testbutton,gtk.TRUE,gtk.TRUE,0)
>
> testbutton=testbutton("test1")
这里再用 testbutton 已经访问不到上面的那个类了。
2004年08月21日 星期六 19:15
python-chinese at lists.python.cn,您好! 为什么我已经运行了,但是却访问不到呢 [root at ctionsofta etc]# /etc/init.d/plone2 status program running; pid=3834 [root at actionsoft etc]# /etc/init.d/plone2 start Plone2 instance main is already running. [root at actionsoft etc]# /etc/init.d/plone2 stop Stopping Plone2 instance main: [ 确定 ] [root at actionsoft etc]# /etc/init.d/plone2 restart Plone2 is not running. Starting Plone2 instance main: [ 确定 ] [root at actionsoft etc]# /etc/init.d/plone2 restart Stopping Plone2 instance main: [ 确定 ] Starting Plone2 instance main: [ 确定 ] 顺颂商祺! 2004-08-21 ---------------------------------------------------- 马伟 "坚持把事情做好,让顾客满意" 南京炎黄盈动科技发展有限公司 Actionsoft Co.,Ltd Tel:8625-85324840 Fax:8625-85324840 Mobile:13337835824 E-mail:mawei.nj at actionsoft.com.cn URL:http://www.actionsoft.com.cn ----------------------------------------------------
Zeuux © 2025
京ICP备05028076号