Python:GtkMenuItem打包带有GtkBox和2个标签

时间:2016-04-19 13:43:12

标签: python xml gtk pygobject appindicator

我正在使用Gtk.Builder()来构建AppIndicator的菜单。目标是让一个MenuItem里面有两个标签(一个在左边,一个在右边),但由于某种原因,第二个标签被忽略,只有第​​一个标签被正确渲染。我很确定它是可能的,因为Gnome文档说明了这一点,而Ubuntu上的DateTime小部件中有相同类型的MenuItem。

<interface>
    <requires lib="gtk+" version="3.12"/>
    <!-- interface-naming-policy project-wide -->
    <object class="GtkMenu">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <child>
            <object class="GtkMenuItem">
                <property name="visible">True</property>
                <child>
                    <object class="GtkBox" id="box">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                            <object class="GtkLabel">
                                <property name="visible">True</property>
                                <property name="label" translatable="yes">Label 1</property>
                                <property name="use_underline">True</property>
                                <property name="halign">start</property>
                            </object>
                        </child>
                        <child>
                            <object class="GtkLabel">
                                <property name="visible">True</property>
                                <property name="label" translatable="yes">Label 2</property>
                                <property name="use_underline">True</property>
                                <property name="halign">end</property>
                            </object>
                        </child>
                    </object>
                </child>
            </object>
        </child>
    </object>
</interface>

我错过了什么吗?

0 个答案:

没有答案