├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── python-publish.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── PyTaskbar ├── ProgressAPI.py └── __init__.py ├── README.md ├── TaskbarLib.tlb ├── docs.md ├── example.py ├── setup.cfg └── setup.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package to PyPI when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: [published] 14 | 15 | permissions: 16 | contents: read 17 | 18 | jobs: 19 | release-build: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - uses: actions/setup-python@v5 26 | with: 27 | python-version: "3.x" 28 | 29 | - name: Build release distributions 30 | run: | 31 | # NOTE: put your own distribution build steps here. 32 | python -m pip install build 33 | python -m build 34 | 35 | - name: Upload distributions 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: release-dists 39 | path: dist/ 40 | 41 | pypi-publish: 42 | runs-on: ubuntu-latest 43 | needs: 44 | - release-build 45 | permissions: 46 | # IMPORTANT: this permission is mandatory for trusted publishing 47 | id-token: write 48 | 49 | # Dedicated environments with protections for publishing are strongly recommended. 50 | # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules 51 | environment: 52 | name: pypi 53 | # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: 54 | # url: https://pypi.org/p/YOURPROJECT 55 | # 56 | # ALTERNATIVE: if your GitHub Release name is the PyPI project version string 57 | # ALTERNATIVE: exactly, uncomment the following line instead: 58 | # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} 59 | 60 | steps: 61 | - name: Retrieve release distributions 62 | uses: actions/download-artifact@v4 63 | with: 64 | name: release-dists 65 | path: dist/ 66 | 67 | - name: Publish release distributions to PyPI 68 | uses: pypa/gh-action-pypi-publish@release/v1 69 | with: 70 | packages-dir: dist/ 71 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | build 3 | dist 4 | *.egg-info 5 | *.egg -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | leenagajbhiye1003@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing: 2 | 3 | ## To Contribute: 4 | - Fork this repository. 5 | - Clone the code. 6 | - Make the Contributions. 7 | - Commit and push your changes to the forked repository. 8 | - Create a pull request on the forked repository. 9 | 10 | ## Changes in the code should have: 11 | - appropriate [docstrings](https://en.wikipedia.org/wiki/Docstring). 12 | - proper code. 13 | - The code should be easily readable. 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 somePythonProgrammer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PyTaskbar/ProgressAPI.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import comtypes.client as cc 3 | 4 | try: 5 | cc.GetModule("./TaskbarLib.tlb") 6 | except: 7 | raise Exception("Could not find TaskbarLib.tlb\nDownload it here and move it to your project directory: WIP") 8 | 9 | import comtypes.gen.TaskbarLib as tbl 10 | from comtypes.gen import _683BF642_E9CA_4124_BE43_67065B2FA653_0_1_0 11 | taskbar = cc.CreateObject( 12 | "{56FDF344-FD6D-11d0-958A-006097C9A090}", 13 | interface=tbl.ITaskbarList3) 14 | 15 | 16 | # Progress types 17 | NORMAL = 0 18 | WARNING = 10 19 | ERROR = 15 20 | LOADING = -15 21 | 22 | PROGRESS_TYPES = [ 23 | NORMAL, 24 | WARNING, 25 | ERROR, 26 | LOADING 27 | ] 28 | 29 | class Progress: 30 | def __init__(self, hwnd: int | None = None): 31 | super().__init__() 32 | 33 | if hwnd is None: 34 | hwnd = ctypes.windll.kernel32.GetConsoleWindow() 35 | self.window_handle = hwnd 36 | 37 | taskbar.ActivateTab(hwnd) 38 | taskbar.HrInit() 39 | 40 | def set_progress(self, value: int, max: int = 100): 41 | if type(value) != int: 42 | raise TypeError(f"Progress.set_progress: expected `value` to be type int, not {type(value)}") 43 | if value < 0: 44 | raise Exception(f"Progress.set_progress: `value` is less than zero: {value} < 0") 45 | if value > max: 46 | raise Exception(f"Progress.set_progress: `value` is greater than max: {value} > {max}") 47 | 48 | taskbar.setProgressValue(self.window_handle, value, max) 49 | 50 | def set_progress_type(self, progress_type: int): 51 | if type(progress_type) != int: 52 | raise TypeError(f"Progress.set_progress_type: expected `progress_type` to be type int, not {type(progress_type)}") 53 | if progress_type not in PROGRESS_TYPES: 54 | raise TypeError(f"Progress.set_progress_type: expected `progress_type` to be one of [NORMAL, WARNING, ERROR, LOADING, DONE], not {progress_type}") 55 | 56 | taskbar.SetProgressState(self.window_handle, progress_type) 57 | 58 | def flash_done(self): 59 | self.reset() 60 | ctypes.windll.user32.FlashWindow(self.window_handle, True) 61 | 62 | def reset(self): 63 | self.set_progress_type(NORMAL) 64 | self.set_progress(0) 65 | 66 | -------------------------------------------------------------------------------- /PyTaskbar/__init__.py: -------------------------------------------------------------------------------- 1 | from .ProgressAPI import Progress 2 | from .ProgressAPI import NORMAL, WARNING, ERROR, LOADING 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyTaskbar 2 | ### The ultimate taskbar progress python package! 3 | 4 | ![](https://img.shields.io/github/downloads/N3RDIUM/PyTaskbar/total) 5 | ![](https://img.shields.io/github/license/N3RDIUM/PyTaskbar?label=license) 6 | ![visitor badge](https://visitor-badge.glitch.me/badge?page_id=N3RDIUM.PyTaskbar) 7 | 8 | [Docs](https://github.com/N3RDIUM/PyTaskbar/blob/main/DOCS.md) 9 | 10 | TODO: Write a good readme 11 | 12 | -------------------------------------------------------------------------------- /TaskbarLib.tlb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/N3RDIUM/PyTaskbar/d2630f8081b0f79e2390afe3907e14db9dcb56bb/TaskbarLib.tlb -------------------------------------------------------------------------------- /docs.md: -------------------------------------------------------------------------------- 1 | # PyTaskbar Docs 2 | 3 | ![](https://img.shields.io/github/downloads/somePythonProgrammer/PyTaskbar/total) 4 | ![](https://img.shields.io/github/license/somePythonProgrammer/PyTaskbar) 5 | 6 | 7 | ## Index 8 | Quick Start: 9 | [Installation](#docs_install) 10 | [Example](#docs_example) 11 | API Docs: [Here](#apidocs) 12 | Contributing: [Contributing guidelines](https://github.com/somePythonProgrammer/PyTaskbar/blob/main/CONTRIBUTING.md) 13 | 14 | 15 | ## **Installation** 16 | PyTaskbar is now on PyPI! Install with: 17 | ``` 18 | pip install PyTaskbar 19 | ``` 20 | 21 | ### From Wheel 22 | 1. Download wheel from this distribution:[LINK](https://github.com/somePythonProgrammer/PyTaskbar/releases/tag/0.0.1). 23 | 2. Do "pip install path-to-wheel.whl" 24 | 3. Try out the [example](#docs_example) now! 25 | 26 | ### Build From Source 27 | Coming soon 28 | 29 | 30 | ## Usage Example 31 | Coming soon 32 | 33 | 34 | ## API Docs 35 | Coming soon 36 | 37 | -------------------------------------------------------------------------------- /example.py: -------------------------------------------------------------------------------- 1 | import time 2 | import PyTaskbar 3 | from PyTaskbar import NORMAL, WARNING, ERROR, LOADING 4 | 5 | progress = PyTaskbar.Progress() 6 | 7 | # Loading animation 8 | progress.set_progress_type(LOADING) 9 | time.sleep(5) 10 | 11 | # Show normal (green) progress 12 | progress.set_progress_type(NORMAL) 13 | for i in range(100): 14 | progress.set_progress(i) 15 | time.sleep(0.05) 16 | 17 | # Make the progress bar yellow 18 | progress.set_progress_type(WARNING) 19 | progress.set_progress(42) 20 | time.sleep(2) 21 | 22 | # Make the progress bar red 23 | progress.set_progress_type(ERROR) 24 | progress.set_progress(42) 25 | time.sleep(2) 26 | 27 | # Flash the taskbar icon 28 | progress.flash_done() 29 | time.sleep(5) 30 | 31 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | name='PyTaskbar', 5 | version='0.1.0', 6 | author='N3RDIUM', 7 | description='The ultimate taskbar progress python package!', 8 | packages = setuptools.find_packages(include=['PyTaskbar']), 9 | package_dir={'PyTaskbar': 'PyTaskbar'}, 10 | classifiers = [ 11 | 'License :: OSI Approved :: MIT License', 12 | 'Operating System :: Microsoft :: Windows :: Windows 10', 13 | ], 14 | python_requires='>=3.6', 15 | install_requires=[ 16 | 'comtypes', 17 | 'pygetwindow', 18 | 'setuptools', 19 | ], 20 | include_package_data=True, 21 | url = 'https://github.com/N3RDIUM/PyTaskbar', 22 | long_description_content_type='text/markdown', 23 | long_description=open('README.md').read(), 24 | zip_safe=False, 25 | # download_url='https://github.com/N3RDIUM/PyTaskbar/archive/refs/tags/0.0.8.tar.gz' 26 | ) 27 | --------------------------------------------------------------------------------