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.1 - No-change packaging update

  • Do not package an old version of pynput.

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.1-py3.4.egg (14.3 kB view details)

Uploaded Egg

pystray-0.3.1-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

pystray-0.3.1-py2.7.egg (29.3 kB view details)

Uploaded Egg

pystray-0.3.1-py2-none-any.whl (45.1 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for pystray-0.3.1-py3.4.egg
Algorithm Hash digest
SHA256 dc1b0cf4c652f388b8998e9f94de8b852714eda397a91558a39deee318f362b0
MD5 a3075adb2ab28a337ac5634d35ca338f
BLAKE2b-256 6bb61bc258931ddda6f941ee7d198adbb2e0e0328299a95e0e6b305b8de926e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pystray-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0323196e1a118eff4dc5fc9737187d0a948a5f0ee9135b95c10a33256a7d3319
MD5 6ca110a2c2ef26f2c4511192264b8ee6
BLAKE2b-256 840af373740a76b674073a372d1473e796d5ba8230045f892b8a8001a3af3fca

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pystray-0.3.1-py2.7.egg
Algorithm Hash digest
SHA256 529d614a2db49c0c1b51b6124615befc5acc07f0c50ced1f3a43fa2167b9d4ac
MD5 3f9d670a3ef81afac1239a186c9e76cc
BLAKE2b-256 7885046372eda2eef49d098c0e3bdc53d3c3a792024253aa1102c1d8b1bd973e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pystray-0.3.1-py2-none-any.whl
Algorithm Hash digest
SHA256 075e6a316e0adfd810c2ee5abf99da2fe1695eea0033a09c86dee60758a7c82d
MD5 4d238adfaa57715c0d6595456c34a357
BLAKE2b-256 ec1f9851c94b2a84a608c19fd8ac2831260db56dff29e92d11e1830ba8cbb0cb

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