pygtk和自定义小部件 [英] pygtk and custom widgets

查看:98
本文介绍了pygtk和自定义小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试为项目编写自定义小部件,但是当我尝试运行使用它的代码时,我收到以下错误


[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:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | 换行 | 行号

推荐答案

我可以告诉你

I can tell you that

展开 | 选择 | Wrap | 行号



我可以告诉你

I can tell you that

展开 | 选择 | Wrap | 行号


我刚试过子类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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆