2012-01-04 79 views
8

在GTK2中,StatusBar只是一个像HBox一样的简单容器。格莱德3(gtk3)现在显示这个消息时,我尝试子部件添加到我的状态栏:如何将孩子添加到Glade3的StatusBar中?

Widgets of type Status Bar need placeholders to add children.

什么是占位符?

我更喜欢在Glade中完全构建用户界面,但如果这不起作用,那么在代码中构建它也可以。我通过GObject内省使用Python 3.2和Gtk。

回答

6

在侏儒3中,状态栏不再是容器;他们更像是一堆消息。显示消息,取得一个新的上下文ID和消息推到与状态栏相关联的消息的堆叠:

context_id = statusbar.get_context_id("progress_message") 
statusbar.push(context_id, "Almost done...") 

statusbar.push(1, "Almost done...") 

而再次把删除该消息,使用statusbar.pop(1)。因此,状态栏中的进度条或图像等内容不再可用。

另请参阅:GtkStatusbar at the Gnome Dev Center