Skip to main content

A Python module to interact with the Windows tray.

Project description

pytray

A Python module to interact with the Windows tray.

Installation

From PyPI

pip3 install ptray

From GitHub

pip3 install git+https://github.com/donno2048/pytray

Usage

Here is a simple example:

import pytray, time, os
pytray.create_tray_element()
pytray.create_menu(
    ("Exit", 1), ("Close", 2)
)
pytray.add_icon()
i = 0
while True:
    start_time = time.time()
    while time.time() - start_time < 0.3:
        click = pytray.what_is_clicked()
        if click == 1:
            exit()
        elif click == 2:
            pytray.hide_menu()
        elif click == None:
            pass
        time.sleep(0.1) # make sure only one click is registered
    pytray.set_icon(os.path.abspath(f"cat\\{i}.ico")) # requires the cat directory from this repo (by Kyome22)
    i = (i + 1) % 5

Project details


Download files

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

Source Distribution

ptray-1.1.2.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file ptray-1.1.2.tar.gz.

File metadata

  • Download URL: ptray-1.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for ptray-1.1.2.tar.gz
Algorithm Hash digest
SHA256 c272b07edeea0f8f3e78cb020ec89160ebdc9d1e6c7df81c912c85aa2324cee0
MD5 2480de71306e54b838fa58c0bfb581b7
BLAKE2b-256 4243176c91cd232084c70752b2bec891cafc5425ff42fef582c5866c52d1ae51

See more details on using hashes here.

Supported by

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