# pytray
A Python module to interact with the Windows tray.
## Installation
### From PyPI
```sh
pip3 install ptray
```
### From GitHub
```sh
pip3 install git+https://github.com/donno2048/pytray
```
## Usage
Here is a simple example:
```py
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/donno2048/pytray",
"name": "ptray",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Elisha Hollander",
"author_email": "just4now666666@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/42/43/176c91cd232084c70752b2bec891cafc5425ff42fef582c5866c52d1ae51/ptray-1.1.2.tar.gz",
"platform": "win32",
"description": "# pytray\r\n\r\nA Python module to interact with the Windows tray.\r\n\r\n## Installation\r\n\r\n### From PyPI\r\n\r\n```sh\r\npip3 install ptray\r\n```\r\n\r\n### From GitHub\r\n\r\n```sh\r\npip3 install git+https://github.com/donno2048/pytray\r\n```\r\n\r\n## Usage\r\n\r\nHere is a simple example:\r\n\r\n```py\r\nimport pytray, time, os\r\npytray.create_tray_element()\r\npytray.create_menu(\r\n (\"Exit\", 1), (\"Close\", 2)\r\n)\r\npytray.add_icon()\r\ni = 0\r\nwhile True:\r\n start_time = time.time()\r\n while time.time() - start_time < 0.3:\r\n click = pytray.what_is_clicked()\r\n if click == 1:\r\n exit()\r\n elif click == 2:\r\n pytray.hide_menu()\r\n elif click == None:\r\n pass\r\n time.sleep(0.1) # make sure only one click is registered\r\n pytray.set_icon(os.path.abspath(f\"cat\\\\{i}.ico\")) # requires the cat directory from this repo (by Kyome22)\r\n i = (i + 1) % 5\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python module to interact with the Windows tray.",
"version": "1.1.2",
"project_urls": {
"Bug Reports": "https://github.com/donno2048/pytray/issues",
"Documentation": "https://github.com/donno2048/pytray#readme",
"Homepage": "https://github.com/donno2048/pytray",
"Source Code": "https://github.com/donno2048/pytray"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4243176c91cd232084c70752b2bec891cafc5425ff42fef582c5866c52d1ae51",
"md5": "2480de71306e54b838fa58c0bfb581b7",
"sha256": "c272b07edeea0f8f3e78cb020ec89160ebdc9d1e6c7df81c912c85aa2324cee0"
},
"downloads": -1,
"filename": "ptray-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "2480de71306e54b838fa58c0bfb581b7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3953,
"upload_time": "2022-05-14T17:47:09",
"upload_time_iso_8601": "2022-05-14T17:47:09.251029Z",
"url": "https://files.pythonhosted.org/packages/42/43/176c91cd232084c70752b2bec891cafc5425ff42fef582c5866c52d1ae51/ptray-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-05-14 17:47:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "donno2048",
"github_project": "pytray",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ptray"
}