Questions tagged [pystray]

The pystray library allows the creation of system tray icons

This library allows the creation of system tray icons. Supported platforms are Linux under Xorg, GNOME and Ubuntu, macOS and Windows.

Github repository, usage and full documentation.

40 questions
1
vote
0 answers

PyInstaller bundle exe not working even after adding additional data

I have a basic python script, Its a speech recognition script to let me shutdown my pc through voice commands and some additional stuff to have a tray icon. I have provided all of the code entirely as its not much. This works perfectly when I run it…
Alp Orgun
  • 15
  • 7
1
vote
0 answers

Problem loading important libraries when using py2exe

I am trying to make a small weather app. Everything going perfect with my codes, except when i used this code to have a systray icon: from pystray import MenuItem as item import pystray def quit_window(icon, item): icon.stop() …
Crazy Mido
  • 11
  • 1
1
vote
1 answer

Pystray icon available when running as a service

Using: Python (3.7.5) Pyinstaller (3.5) Pywin32 (223) Pystray (Current) I have a python program that uses Pystray to show an icon which allows me to make Tkinter window available. It took a while but, thanks to stack overflow, this…
Matthew Baker
  • 2,637
  • 4
  • 24
  • 49
0
votes
0 answers

Run a function inside an icon with rumps

Problem: Very new to programming, but I am trying to build off a simple rumps example and thought I could just call a function from another file inside of a decorator that associates the function with the "Run Program" menu item but it seems like…
0
votes
1 answer

PyStray stops working once the main loop is launched (detached mode)

I am working on a side project which entails a main process that spawns an HTTP server that keeps listening for events and handles them within an infinite loop. This works as intended and I am now trying to add support for the start and stops of all…
fedmag
  • 55
  • 7
0
votes
0 answers

PyWebview and PysTray - show/hide window on tray icon click?

I am attempting to make a simple webview of Google.com using PyWebview that can keep an icon present in the Windows system tray. On clicking the system tray icon, if the webview window is visible, the window will be hidden, and if it is not visible…
0
votes
0 answers

How to create a hotkey or shortcut to maximize a tkinter application that is hidden in the system tray?

I am currently working on a windows application that will consist of a window that will start hidden in the system tray, which is done using pystray library and then the program will keep running in the background and will pop up on top when a…
0
votes
0 answers

Win32 in Python - LoadImage gets handle of icon but InsertMenuItem throws error

I'm trying to add an icon to every menu option in a systray library in Python, pystray. For that I'm using win32 functions, I can sucessfully load an icon with extension .ico using the LoadImage function and I get an handle (HBITMAP) to it, next…
digfish
  • 316
  • 2
  • 11
0
votes
1 answer

How to create a recursive folder menu using pystray?

I am trying to create a navigable tree of folders and subfolders using pystray. I am having trouble creating a recursive menu with pystray. I am getting an error "TypeError: MenuItem.__init__() takes from 3 to 8 positional arguments but 1757 were…
Collaxd
  • 425
  • 3
  • 12
0
votes
0 answers

how to use pystray on MacOS to minimize python code to tasktray and run in background

how to use pystray on MacOS to minimize python code to tasktray and run in background? i tried to use icon.run() and it successfully minimize to tasktray but the program hold. it is only resume when i click and reopen the window. i also tried…
jiaqi xu
  • 9
  • 2
0
votes
0 answers

pystray on MacOS to use run_detached, program crashed

I am trying to use pystray to create a icon on tasktray, it is working on windows but now I am building one for Mac. I need the program minimize to tasktray on run on background. so I need to use icon.run_detached() instead of icon.run(). However,…
jiaqi xu
  • 9
  • 2
0
votes
0 answers

why this code doesn't going to the next iteration and doesn't show alternate icons

why this code doesn't iterate.if it is not iterate then it will not display different icons as mentioned in the if else statement.give me some solution import time import pystray from PIL import Image img_1 = Image.open("Green.ico") img_2 =…
0
votes
0 answers

How can I change tkinter app pystray icon on specific case?

I have App class and I want to call "change_icon" definition from inside App class. In current situation it is only can be triggered with menu item of pystray. Below is my code: from pystray import MenuItem as item import pystray from PIL import…
0
votes
0 answers

How to code a file watchdog and system tray utility in Python

All, I have started coding a system tray utility in Windows 10 & 11 to assist in my daily workload as an Engineer (Not Software). It gives me some responses to APIs in a toast style notification and calculates some minor things. My issue is that I…
Adam
  • 23
  • 7
0
votes
0 answers

How to add tray to python script with looping in it

i'm trying to make some kind of api to get device info per x second to database, and willing to make convert the python to .exe, the problem is, when .exe run later it must closed from task manager, if there any way to make pystray or any tray…