python - AppIndicator3.指示器: is there a way to hide/show it at runtime?

标签 python gtk pygobject

我试图隐藏“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)

http://lazka.github.io/pgi-docs/#AppIndicator3-0.1/classes/Indicator.html#AppIndicator3.Indicator.set_status

关于python - AppIndicator3.指示器: is there a way to hide/show it at runtime?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52724273/

相关文章:

python - GradientTape : LookupError: No gradient defined for operation 'IteratorGetNext' (op type: IteratorGetNext) 中的简单 Keras 网络

python - Gtk3 上带有 PyGObject 的 Webkit 线程

gtk - 如何在其绘制信号处理程序中获取 GtkDrawingArea 的无效区域

python - 在不重启的情况下为django中的所有进程/线程重新加载.mo文件

python - 如何使用 Pandas 处理行对并在没有字典的情况下保留 ID 列?

python - "Can' t 不同大小 vector 值之间的转换"

python - 每秒更新 GTK+ MenuItem 倒计时,并定期调用函数

Python GTK3 Evince 查看器 - 如何重新加载文档?

C Gtk+2 Glade3 : how can i set a SourceBuffer to a GtkSourceView that was loaded from glade?

python - 获取当前 GTK 主题的字体颜色