pytray
A Python module to interact with the Windows tray.
Installation
[!WARNING] The package will be installed on non-Windows platforms with no errors.
This is for automation purposes only, as the package will only work on Windows.
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
Metadata
Release files for ptray 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ptray-1.2.3.tar.gz | 4.2 kB | Details |
Release files / ptray-1.2.3.tar.gz
| Download URL | ptray-1.2.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33b98ea5db873f26b52970c28f08b255f958a75a7148f2e4118106956082cd3c
|
|
BLAKE2b-256 checksum How to use checksums |
9060836c5136be8674688c016bf423c441a2adda1e4d2df7e8352320744be453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.
Transparency log