AppIndicator3.Indicator:有没有办法在运行时隐藏/显示它?

问题描述 投票:0回答:2

我试图隐藏“AppIndicator3.Indicator”一旦显示,但到目前为止我所有的尝试都失败了。

到目前为止,我尝试将实例设置为

None
,希望垃圾收集器将其删除,并且我尝试将菜单设置为
None

这就是我展示它的方式:

def __show_app_indicator(self) -> None:
    if AppIndicator3:
        icon_theme = Gtk.IconTheme.get_default()
        icon_name = icon_theme.lookup_icon('weather-showers-symbolic', 16, 0).get_filename()
        self.__app_indicator: AppIndicator3.Indicator = AppIndicator3.Indicator \
            .new(APP_ID, icon_name, AppIndicator3.IndicatorCategory.HARDWARE)
        self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
        self.__app_indicator.set_menu(self.__app_indicator_menu)
python gtk pygobject
2个回答

0
投票

TingPing 的答案中的链接不起作用(404),因此这里有一个可用的链接,并且包含有关 appindicator 状态的文档:https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Porting_Guide_for_Applications

© www.soinside.com 2019 - 2024. All rights reserved.