Python 指示器:有没有办法在运行时隐藏/显示它?
我试图隐藏一次显示的'AppIndicator3.Indicator',但到目前为止,我所有的尝试都失败了 到目前为止,我试图将实例设置为Python 指示器:有没有办法在运行时隐藏/显示它?,python,gtk,pygobject,Python,Gtk,Pygobject,我试图隐藏一次显示的'AppIndicator3.Indicator',但到目前为止,我所有的尝试都失败了 到目前为止,我试图将实例设置为None,希望垃圾收集器将其删除,并尝试将菜单设置为None 这就是我展示的方式: def __show_app_indicator(self) -> None: if AppIndicator3: icon_theme = Gtk.IconTheme.get_default() icon_name = icon_
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)
self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)