Skip to main content

Provides systray integration

Project description

pystray Package Documentation

This library allows you to create a system tray icon.

Creating a system tray icon

In order to create a system tray icon, the class pystray.Icon is used:

import pystray

icon = pystray.Icon('test name')

In order for the icon to be displayed, we must provide an icon. This icon must be specified as a PIL.Image.Image:

from PIL import Image, ImageDraw

# Generate an image
image = Image.new('RGB', (width, height), color1)
dc = ImageDraw.Draw(image)
dc.rectangle((width // 2, 0, width, height // 2), fill=color2)
dc.rectangle((0, height // 2, width // 2, height), fill=color2)

icon.image = image

To ensure that your application runs on all platforms, you must then run the following code to show the icon:

def setup(icon):
    icon.visible = True

icon.run(setup)

The call to pystray.Icon.run() is blocking, and it must be performed from the main thread of the application. The reason for this is that the system tray icon implementation for OSX must be run from the main thread, and it requires the application runloop to be running. pystray.Icon.run() will start the runloop.

The code in setup() will be run in a separate thread once the system tray icon is ready. The icon does not wait for it to complete, so you may put any code that would follow the call to pystray.Icon.run() in it.

pystray.Icon.run() will not complete until ~pystray.Icon.stop() is called.

Release Notes

v0.3 - Proper Python 3 Support

  • Corrected Python 3 bugs.

  • Made Icon.run() mandatory on all platforms.

v0.2 - Initial Release

  • Support for adding a system tray icon on Linux, Mac OSX and Windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pystray-0.3-py3.4.egg (62.3 kB view details)

Uploaded Egg

pystray-0.3-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

pystray-0.3-py2.7.egg (155.3 kB view details)

Uploaded Egg

pystray-0.3-py2-none-any.whl (231.0 kB view details)

Uploaded Python 2

File details

Details for the file pystray-0.3-py3.4.egg.

File metadata

  • Download URL: pystray-0.3-py3.4.egg
  • Upload date:
  • Size: 62.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pystray-0.3-py3.4.egg
Algorithm Hash digest
SHA256 cad68823ed764245d4a921b2b1c04512c2616a22716effe5a7a0d1988ba53032
MD5 9ec7d9fd830180fc9ee479dbaba277a7
BLAKE2b-256 88f353b933226256b4c6e6bfd9765cba4c3732ab4809335730babc04e09a205c

See more details on using hashes here.

File details

Details for the file pystray-0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pystray-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7c7bb682c6f1038273b43817e2d10ca028c996d5970377c09ffa917b3f385db
MD5 26cd7dc7b31172c09d4e5f10a8356f96
BLAKE2b-256 90795db74593b51e85f82a52df62010cb09edb4864dbd416dabdd48a530a608d

See more details on using hashes here.

File details

Details for the file pystray-0.3-py2.7.egg.

File metadata

  • Download URL: pystray-0.3-py2.7.egg
  • Upload date:
  • Size: 155.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pystray-0.3-py2.7.egg
Algorithm Hash digest
SHA256 0aadafb0f6b7facf34bb503735d20d79bceeb78dbe67451f4697111321a82c61
MD5 2a3e200211d2b514f4667b1249e87b48
BLAKE2b-256 613be4a8534a2e95d9a423df5012cf7e9521798a19366198405358ddfabd7bda

See more details on using hashes here.

File details

Details for the file pystray-0.3-py2-none-any.whl.

File metadata

File hashes

Hashes for pystray-0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 06945513660756f2e853284235a5606612e458efcaabb8f759e8071a46ab08ce
MD5 a638ccd6e172d25923b9c477373cfc32
BLAKE2b-256 c623f859ca52266e99489b93d45ad3f85fd845d587e3941c7e04bd52ead128f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page