将python脚本放入系统托盘的最简单方法是什么(Windows)

时间:2022-05-02 11:49:57

What's the simplest way to put a python script into the system tray?

将python脚本放入系统托盘的最简单方法是什么?

My target platform is Windows. I don't want to see the 'cmd.exe' window.

我的目标平台是Windows。我不想看到'cmd.exe'窗口。

1 个解决方案

#1


48  

Those are two questions, actually:

这是两个问题,实际上:

  1. Adding a tray icon can be done with Win32 API. Example: SysTrayIcon.py
  2. 使用Win32 API可以添加托盘图标。示例:SysTrayIcon.py
  3. Hiding the cmd.exe window is as easy as using pythonw.exe instead of python.exe to run your scripts.
  4. 隐藏cmd.exe窗口就像使用pythonw.exe而不是python.exe来运行脚本一样简单。

#1


48  

Those are two questions, actually:

这是两个问题,实际上:

  1. Adding a tray icon can be done with Win32 API. Example: SysTrayIcon.py
  2. 使用Win32 API可以添加托盘图标。示例:SysTrayIcon.py
  3. Hiding the cmd.exe window is as easy as using pythonw.exe instead of python.exe to run your scripts.
  4. 隐藏cmd.exe窗口就像使用pythonw.exe而不是python.exe来运行脚本一样简单。