以下是重现我的问题的步骤:我在 Glade 3.10.0 中设计了一个 UI,其中包括一个包含 4 个按钮的 GtkButtonBox:
<object class="GtkButtonBox" id="i_bbox">
<property name="visible">True</property>
[...] some children (buttons)
glade 文件被加载到 python 脚本中:
builder_fname = "example_layout.glade"
self.root = gtk.Builder()
self.root.add_from_file(builder_fname)
self.root.connect_signals(self)
当脚本执行时,它会出现段错误,并显示以下回溯:
./example.py:37: Warning: cannot create instance of abstract (non-instantiatable) type `GtkButtonBox'
self.root.add_from_file(builder_fname)
[1] 5088 segmentation fault (core dumped) ./example.py
有人知道如何解决这个问题吗?我正在使用 pygtk 2.24.0
最佳答案
警告似乎暗示您需要使用 GtkHButtonBox 或 GtkVButtonBox 与 GtkButtonBox ......这些会出现段错误吗?
关于python - 为什么 python 2.7.2 pygtk 解析空地 GtkButtonBox 会出现段错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6712865/