Python gi.repository.Gtk 模块,MenuBar() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用gi.repository.Gtk.MenuBar()

项目:hubangl    作者:soonum    | 项目源码 | 文件源码
def __init__(self, default_app=None):
        self.images = images.HubanglImages()
        self._load_custom_css()

        self.window = Gtk.Window()
        self.window.set_title("HUBAngl")
        #self.window.connect("delete_event", lambda w, e: Gtk.main_quit())
        self.window.set_position(Gtk.WindowPosition.CENTER)
        self.window.set_icon_from_file(self.images.logo_favicon_path)
        self.window.connect("delete_event", self.on_mainwindow_close)

        if default_app:
            self.current_app = default_app
        else:
            self.current_app = BaseApp(self.window, "standalone", self.images)
            self.current_app_container = self.current_app.container

        self.menu_bar = Gtk.MenuBar()
        self.menu_item_new = self._build_menu_new(self.menu_bar)
        self.menu_item_feed = self._build_menu_feed(self.menu_bar)
        self.menu_item_view, self.current_view_mode = self._build_menu_view(
                self.menu_bar
        )
        self.menu_item_help = self._build_menu_help(self.menu_bar)

        self.main_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.main_vbox.pack_start(self.menu_bar, False, False, 0)
        self.main_vbox.pack_end(self.current_app_container, True, True, 0)

        self.window.add(self.main_vbox)
        self.window.show_all()

        self.current_app.make_app()