Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一些程序员创建 Window 类:
class PyApp(gtk.Window): ...
我已经用 Glade 定义了我的窗口,然后我可以得到它:
xmlTree.get_widget('window')
有没有办法将此对象用作类并扩展它?我想像其他程序员一样处理它,但使用我定义的窗口。我不想得到一个类和一个窗口属性。
谢谢你。
我能想到的最简单的方法是使用 Glade 构建一个 Alignment 布局,其中包含您希望窗口看起来的小部件。你的课程可以是这样的:
class PyApp(gtk.Window): def __init__(self, filename, widget_name): # Use builder to open filename ... # and then add the alignment widget: self.add(builder.get_object(widget_name))