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
5
votes
1 answer

How to create menu and update icon in Pystray

I want to use pystray module in Python to create a system tray app on Windows. Code Until now I managed to write this: import pystray from PIL import Image image = Image.open("image.gif") icon = pystray.Icon(name ="SPAM!", icon =image, title…
Jakub Bláha
  • 1,491
  • 5
  • 22
  • 43
4
votes
1 answer

Change pystray tray notification title

I have an issue with finding a way to change the pystray tray notification title. It appears that it's taking a default value of "Python" from somewhere. See the image below: In the documentation, there are no additional parameters to change the…
noszone
  • 172
  • 9
4
votes
1 answer

pyautogui issue with Pystray

Having issue with pyautogui and pystray. Using python Version 3.6.4. Simply importing both modules into the same script and calling any pyautogui function produces an error. Is there a fix to this or a work around?? I simply want to use the…
3
votes
1 answer

Getting left-click on tray icon (Python | Pystray)

I am working on creating a tkinter window when the pystray icon is pressed so I can make my own Menu in the tray. But I have no idea how to get if the tray icon is pressed. Any help is appreciated! Thanks in advance!
vSteppY
  • 31
  • 3
3
votes
1 answer

sys.exit in python gives a SystemExit error pystray

I am running a PYSTRAY icon which starts a console program. When I try stopping it with this code def stop_rtd(): print("Stopping RTD") sys.exit() icon.stop() The system throws back this error An error occurred when calling message…
Tej
  • 31
  • 1
3
votes
2 answers

failed to execute script myfile.py using pyinstaller

from tkinter import* from tkinter import filedialog import tkinter.ttk as ttk import datetime import os import pystray from pystray import MenuItem as item import win32com.client import PIL.Image as Image my import list pyinstaller --noconsole…
2
votes
1 answer

Include Pystray Icon when using PyInstaller

I am using PyInstaller to create a single file exe for my python application. I am also using Pystray to create a tray icon with a menu on it. When running the script directly it works, but when I use pyinstaller I get an error that the "icon.png"…
Developer Gee
  • 362
  • 3
  • 12
2
votes
1 answer

Why can't I close when using pystray?

I've written a program using tkinter which when the main window is closed is supposed to be minimized to the system tray. But when I try to exit the program clicking "Close" in the tray that triggers the following function: def quit_window(icon,…
DGDays
  • 76
  • 12
1
vote
0 answers

Remove pystray icon from outside of pystray menu

I have tkinter app which I am trying to add pystary icon. I just implemented it successfully. But I want to call "show window" method from another class not only from the menu item of pystray. But in order to do that I have to pass icon parameter.…
1
vote
1 answer

Dynamically change tray icon with pystray

I want the tray icon to change according to the value of p_out. Specifically depending on its value, I want it to get a different color. Here's the code import pystray import ping3 while True: p_out = ping3.ping("google.com", unit="ms") if…
1
vote
1 answer

tkinter Toplevel window won't open from system tray menu

I'm trying to open a Toplevel window with tkinter, from a system tray menu. from cmath import phase from tkinter import * from tkinter import messagebox, messagebox from tracemalloc import start from pystray import MenuItem as item import…
nigel239
  • 1,485
  • 1
  • 3
  • 23
1
vote
1 answer

How to properly use run_detached() and stop() in pystray?

I'm trying to use pystray without blocking the main thread. Based on the pystray docs we can use the function run_detached() to start without blocking. I'm using pystray on windows so, apparently I don't need to pass any argument to run_detached()…
JonLord
  • 175
  • 9
1
vote
1 answer

Start Python script GUI minimized / in Windows Tray | Tkinter

I´ve built a simple GUI app, and I´m playing with pystray. Actually, my script starts as usual, the first thing you see is the GUI. If you klick on exit, the GUI minimize, and the tray Icon spawns. For now, i search a way to start my script in this…
iWischMob
  • 49
  • 6
1
vote
1 answer

pystray with other codes execution

I require a code, to launch tray icon and execute other parts of codes... So for that I tried below: from pystray import MenuItem as item import pystray from PIL import Image, ImageDraw import time def action(): pass def exit(icon): …
Rabe
  • 67
  • 1
  • 2
  • 7
1
vote
1 answer

How to provide dropdown submenus inside one tray menu as below shown in image using pystray library in python?

Here is my sample code: image = Image.open("E:\\production\\Windows utility tool\\images\\icon.ico") menu = (item("Sign in", show_window), item("Change status", status_online), item("Change icon", change_icon), item("Open application",…
1
2 3