pygtk和自定义小部件 [英] pygtk and custom widgets
问题描述
我一直在尝试为项目编写自定义小部件,但是当我尝试运行使用它的代码时,我收到以下错误
[sbox-SDK_PC: 〜/ code / nokia / trunk]> ./nokiagui.py
Traceback(最近一次调用最后一次):
文件" /home/jubei/code/nokia/trunk/nokiagui.py" ;,第427行,在?
gui = NewGui()
文件" /home/jubei/code/nokia/trunk/nokiagui.py" ;,第193行,在__init __
button = pkylib.ComboButton((foo,bar,baz))
文件" / home / jubei / code / nokia / trunk /pkylib.py" ;,第21行,在__init__
gtk.Widget .__ init __(self)
TypeError:无法创建抽象实例(非实例化)类型`GtkWidget ''
[sbox-SDK_PC:〜/ code / nokia / trunk]>
这里是我写的代码:
I''ve been trying to write a custom widget for a project, however when i try to run code that uses it i get the following error
[sbox-SDK_PC: ~/code/nokia/trunk] > ./nokiagui.py
Traceback (most recent call last):
File "/home/jubei/code/nokia/trunk/nokiagui.py", line 427, in ?
gui = NewGui()
File "/home/jubei/code/nokia/trunk/nokiagui.py", line 193, in __init__
button = pkylib.ComboButton(("foo","bar","baz"))
File "/home/jubei/code/nokia/trunk/pkylib.py", line 21, in __init__
gtk.Widget.__init__(self)
TypeError: cannot create instance of abstract (non-instantiable) type `GtkWidget''
[sbox-SDK_PC: ~/code/nokia/trunk] >
and here is the code that i have written:
推荐答案
我可以告诉你
I can tell you that
我可以告诉你
I can tell you that
我刚试过子类HBox而不是小部件,我现在没有任何编译或运行时错误,但按钮和条目不显示
i just tried subclass HBox instead of widget, i dont get any compile or runtime errors now, but the button and entry dont show up
这篇关于pygtk和自定义小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!