问题标签 [pystray]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - pystray 与其他代码执行
我需要一个代码来启动托盘图标并执行代码的其他部分......
因此,我在下面尝试了:
这会启动托盘图标,但不会执行我的循环。(它只在我停止图标后执行)
python-3.x - 如何仅在一个子菜单(不在多个)上显示复选标记,如下图所示,使用 python pystray 库?
这是我的示例代码单击打开屏幕截图 我尝试使用状态变量来实现,但在这种情况下,它会在两个子菜单上打勾。
python - 将“pystray”与 Pyinstaller 一起使用时如何修复“ImportError:此平台不支持”?
因此,在我编译了我使用pyinstaller
inone-file
模式编写的程序后,该程序似乎根本无法运行。
当我尝试执行它时,我在窗口中收到以下异常:
这里可能是什么问题?我的意思是我该如何解决这个问题?
我目前正在运行:
Python 3.9
Windows 10 (最新版本)
Visual Studio Code
python - Cannot hide Pystray icon in Ubuntu
I'm trying to build an application using python pystray module and I've tested my code in all Windows10, Ubuntu20 and MacOS11 machines. In Ubuntu the behavior is little different. In Windows and MacOS, when I click the "Exit" menu item, the system tray icon disappears right away and when both threads finished the program exits. But in Ubuntu when I click the "Exit" menu item, the icon does not dissappear. It is visible until both threads exit.
As a workaround, I can use a smaller sleep time and hide/exit the icon faster but is there a better option? I'm using appindicator module here and gtk, xorg modules don't even show the icon.
Question is: Is it possible to hide the tray icon right away in Ubuntu and if so how?
python - 启动 Python 脚本 GUI 最小化 / 在 Windows 托盘 | 特金特
我已经构建了一个简单的 GUI 应用程序,并且正在使用pystray
. 实际上,我的脚本照常启动,您首先看到的是 GUI。如果您单击退出,则 GUI 会最小化,并且会出现托盘图标。
现在,我搜索了一种以这种“托盘模式”启动脚本的方法,这里有一些信息:
如果您需要更多信息,请询问我,非常感谢!此致
背景:我的程序应该放在win10的自动启动中,但我不想每次重新启动电脑时都最小化窗口
python - 使用 Python/pystray,如何通过单击从系统托盘图标最大化窗口?
在这篇文章之后,我实现了将应用程序的窗口最小化到系统托盘。
但是,我不知道如何通过单击系统的托盘图标来恢复窗口。只能打开菜单并选择“显示”选项。单击该图标,会引发 TypeError:
对我有什么提示吗?谢谢
python - 如何在 Pystray 中使用多个参数调用函数?
我正在尝试将额外的参数传递给由 pystray 菜单中的项目调用的函数。
在此示例中,当我在 pystray 菜单中按“退出”时,我试图传递参数“消息”调用函数“quit_window”。这里的问题是默认情况下菜单构造中使用的函数没有参数,并且在内部引用图标。当我使用参数时,构造函数不会将图标引用传递给调用 stop() 并且由于我在 pystray.Menu 之后创建 pystray.Icon 我不知道如何传递此信息并使其工作。
python - 如何在 pystray 中正确使用 run_detached() 和 stop()?
我正在尝试在不阻塞主线程的情况下使用 pystray。基于 pystray 文档,我们可以使用该功能run_detached()
启动而不会阻塞。
我在 Windows 上使用 pystray 所以,显然我不需要传递任何参数run_detached()
来工作。
我尝试的第一件事是运行这段代码:
但我收到了这个错误:
因此,我尝试通过更改 _base.py 中的第 384 行删除设置变量来绕过此错误
代码按预期工作,并创建了菜单按钮正常工作的托盘图标。
问题是当我按“退出”时,因为该stop()
功能不像我使用icon.run()
. 线程似乎继续运行,托盘图标保持冻结,程序没有结束。
还有另一种方法可以使这项工作正常进行吗?
编辑:我在官方 git 存储库LINK中发现了这个问题,它似乎是一个已经报告的错误。我想知道是否有可能做出解决方法。
python - Pystray - 如何使用 Tkinter 双击系统托盘图标打开程序?
谢谢阅读。我需要帮助,我需要通过双击隐藏图标来打开程序。像这样: