AppIndicator3.Indicator:有没有办法在运行时hide/show它?
AppIndicator3.Indicator: is there a way to hide/show it at runtime?
我试图隐藏曾经显示的 `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)
self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
我试图隐藏曾经显示的 `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)
self.__app_indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)