Python package that provides easy access to Tabler Icons for PyQt and PySide applications.
Project description
Tabler QIcon
Tabler QIcon
is a Python package that provides easy access to Tabler Icons [Preview] [GitHub] for PyQt and PySide applications. It uses SVGs from Tabler Icons and converts them into QIcon objects, which can be used in PyQt and PySide applications.
This library also supports icon customization such as changing color, size, view box size, stroke width, and opacity.
Preview icons
🚀 Features
-
Customizable Icons: Adjust color, size, view box size, stroke width, and opacity.
-
Developer-Friendly: Python stubs enhance code autocompletion and type-checking in your IDE.
Code Autocompletion
-
Broad Compatibility: Supports PyQt5, PyQt6, PySide2, and PySide6.
📋 Prerequisites
- Python 3.7 or later
- One of the following: PyQt5, PyQt6, PySide2, or PySide6
💻 Installation
You can install tabler-qicon
from PyPI using pip:
pip install tabler-qicon
Alternatively, you can install it directly from the GitHub repository:
pip install git+https://github.com/promto-c/tabler-qicon.git
Using PyQt5? Install it separately:
pip install PyQt5
🖌️ Usage
Setting the Backend
Using Environment Variables (with qtpy
)
If you're using qtpy
to maintain compatibility across different PyQt/PySide backends, you'll need to specify the backend before importing other modules:
import os
os.environ['QT_API'] = 'PyQt5' # Change 'PyQt5' to your desired backend
from tablerqicon import TablerQIcon
# ... Additional code ...
Using the use_backend
method
Alternatively, you can also set the backend directly using the use_backend
method:
import tablerqicon
tablerqicon.use_backend('PyQt5')
from tablerqicon import TablerQIcon
# ... Additional code ...
Default Usage
Directly access icons with default properties:
from PyQt5 import QtWidgets
from tablerqicon import TablerQIcon
# ... Additional code ...
refresh_button = QtWidgets.QPushButton("Refresh")
# Set the QIcon for the refresh_button using the 'refresh' icon name as an attribute
refresh_button.setIcon(TablerQIcon.refresh)
Customized Icons
- Instantiate
TablerQIcon
with your desired properties. - Access icons using icon names.
from PyQt5 import QtWidgets
from tablerqicon import TablerQIcon
# ... Additional code ...
# Example: Using a custom opacity
tabler_icon = TablerQIcon(opacity=0.6)
refresh_button = QtWidgets.QPushButton("Refresh")
refresh_button = QtWidgets.QPushButton("Word Wrap")
# Set the QIcon for the refresh_button using the 'refresh' icon name as an attribute
refresh_button.setIcon(tabler_icon.refresh)
# Set the QIcon for the word_wrap_button using the 'text_wrap' icon name as an attribute
word_wrap_button.setIcon(tabler_icon.text_wrap)
Retrieve All Icon Names
print(TablerQIcon.get_icon_names())
🛠️ Development
Run the tests:
pytest tests
🖋️ Coding Style
Adhering to PEP 8 with flake8 oversight. Auto-formatting via yapf. Our docstrings embrace the Google Python Style Guide for clarity and consistency.
📜 License
Tabler QIcon
is licensed under the MIT License.
Note: This
README.md
file was generated by ChatGPT.
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
Built Distribution
File details
Details for the file tabler-qicon-0.1.0.tar.gz
.
File metadata
- Download URL: tabler-qicon-0.1.0.tar.gz
- Upload date:
- Size: 464.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5da3d7d5697477f8b295ea6fc86e8ca68a131e1aa6ed9c733e0be43315c10176 |
|
MD5 | bddd2bf5b0a69488df1ecfebfe084fea |
|
BLAKE2b-256 | 54923b21e3fdc30f2c000fadc4a0b25a3640e31a0efe8918d34ab448a806e6d9 |
File details
Details for the file tabler_qicon-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tabler_qicon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8702745c096f3b2a2b29abc7b145715564423b75117b1100cbdbcc4a7ddb8f8 |
|
MD5 | 59a579fe71f03db87dccb80491cf4f21 |
|
BLAKE2b-256 | 389b13ef1c40f74c1f9f7e1f10d7f3e8306d29e55e4283882aa73967ed153ee1 |