A Python module to interact with the Windows tray.
Project description
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
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.2.2.tar.gz
(4.2 kB
view details)
File details
Details for the file ptray-1.2.2.tar.gz.
File metadata
- Download URL: ptray-1.2.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
209f1ed84f9bc8a4677ae58f8497f11ecdefbfa62b938d734e28dbbf611fad31
|
|
| MD5 |
39f23bddeefc63d20b09db1d5433e3d8
|
|
| BLAKE2b-256 |
fe95a2dc591eea42c080a9d6108ed99d941849fbabce71d93622b99d632a8a90
|
Provenance
The following attestation bundles were made for ptray-1.2.2.tar.gz:
Publisher:
python-publish.yml on donno2048/pytray
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ptray-1.2.2.tar.gz -
Subject digest:
209f1ed84f9bc8a4677ae58f8497f11ecdefbfa62b938d734e28dbbf611fad31 - Sigstore transparency entry: 1305529527
- Sigstore integration time:
-
Permalink:
donno2048/pytray@5cbd0c7e645085f7e12e81a66a7e756fac20ca83 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/donno2048
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5cbd0c7e645085f7e12e81a66a7e756fac20ca83 -
Trigger Event:
release
-
Statement type: