Web Analytics Made Easy - Statcounter
Skip to content

Only for Qt and Wx ports. Use psgtray package for the tkinter port

SystemTray

SystemTray documentation

A "Simulated System Tray" that duplicates the API calls available to PySimpleGUIWx and PySimpleGUIQt users.

All of the functionality works. The icon is displayed ABOVE the system tray rather than inside of it.
SystemTray(
    menu = None,
    filename = None,
    data = None,
    data_base64 = None,
    tooltip = None,
    metadata = None
)

Parameter Descriptions

Name Type Default Description
data bytes None in-ram image for icon (same as data_base64 parm)
data_base64 bytes None base-64 data for icon
filename str None filename for icon
menu List[List[List[str] or str]] None Menu definition. Example - ['UNUSED', ['My', 'Simple', '---', 'Menu', 'Exit']]
metadata Any None User metadata that can be set to ANYTHING
tooltip str None tooltip string

Class Properties

metadata

metadata

Metadata is an SystemTray property that you can use at any time to hold any value

metadata
Parameter Descriptions

Name Type Default Description
RETURN Any the current metadata value

Class Methods

 def close
 def hide
 def notify
 def read
 def show_message
 def un_hide
 def update

close

Close the system tray window

close()

hide

Hides the icon

hide()

notify

This is a class method (implements the @classmethod decorator).

Displays a "notification window", usually in the bottom right corner of your display. Has an icon, a title, and a message The window will slowly fade in and out if desired. Clicking on the window will cause it to move through the end the current "phase". For example, if the window was fading in and it was clicked, then it would immediately stop fading in and instead be fully visible. It's a way for the user to quickly dismiss the window.

notify(
    title,
    message,
    icon = ...,
    display_duration_in_ms = 3000,
    fade_in_duration = 1000,
    alpha = 0.9,
    location = None
)
To call the method without creating an instance of the object:
sg.SystemTray.notify(
    title,
    message,
    icon = ...,
    display_duration_in_ms = 3000,
    fade_in_duration = 1000,
    alpha = 0.9,
    location = None
)

Parameter Descriptions

Name Type Default Description
alpha float 0.9 Alpha channel. 0 - invisible 1 - fully visible
display_duration_in_ms int 3000 Number of milliseconds to show the window
fade_in_duration int 1000 Number of milliseconds to fade window in and out
icon bytes or str b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAEKAAABCgEWpLzLAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAHJQTFRF////ZsxmbbZJYL9gZrtVar9VZsJcbMRYaMZVasFYaL9XbMFbasRZaMFZacRXa8NYasFaasJaasFZasJaasNZasNYasJYasJZasJZasJZasJZasJZasJYasJZasJZasJZasJZasJaasJZasJZasJZasJZ2IAizQAAACV0Uk5TAAUHCA8YGRobHSwtPEJJUVtghJeYrbDByNjZ2tvj6vLz9fb3/CyrN0oAAADnSURBVDjLjZPbWoUgFIQnbNPBIgNKiwwo5v1fsQvMvUXI5oqPf4DFOgCrhLKjC8GNVgnsJY3nKm9kgTsduVHU3SU/TdxpOp15P7OiuV/PVzk5L3d0ExuachyaTWkAkLFtiBKAqZHPh/yuAYSv8R7XE0l6AVXnwBNJUsE2+GMOzWL8k3OEW7a/q5wOIS9e7t5qnGExvF5Bvlc4w/LEM4Abt+d0S5BpAHD7seMcf7+ZHfclp10TlYZc2y2nOqc6OwruxUWx0rDjNJtyp6HkUW4bJn0VWdf/a7nDpj1u++PBOR694+Ftj/8PKNdnDLn/V8YAAAAASUVORK5CYII=' A base64 encoded PNG/GIF image or PNG/GIF filename that will be displayed in the window
location (int, int) None Location on the screen to display the window
message str Text message that makes up the majority of the window
title str Text to be shown at the top of the window in a larger font
RETURN int (int) reason for returning

read

Reads the context menu

read(
    timeout = None
)

Parameter Descriptions

Name Type Default Description
timeout None Optional. Any value other than None indicates a non-blocking read

show_message

Shows a balloon above icon in system tray

show_message(
    title,
    message,
    filename = None,
    data = None,
    data_base64 = None,
    messageicon = None,
    time = (1000, 3000)
)

Parameter Descriptions

Name Type Default Description
data b'' None Optional in-ram icon
data_base64 b'' None Optional base64 icon
filename str None Optional icon filename
message str Message to be displayed
time int or (int, int) (1000, 3000) Amount of time to display message in milliseconds. If tuple, first item is fade in/out duration
title str Title shown in balloon
RETURN Any The event that happened during the display such as user clicked on message

un_hide

Restores a previously hidden icon

un_hide()

update

Updates the menu, tooltip or icon

update(
    menu = None,
    tooltip = None,
    filename = None,
    data = None,
    data_base64 = None
)

Parameter Descriptions

Name Type Default Description
data ??? None icon raw image
data_base64 ??? None icon base 64 image
filename ??? None icon filename
menu ??? None menu defintion
tooltip ??? None string representing tooltip