pytablericons
Python wrapper for the Tabler Icons library - a set of 5237 free MIT-licensed high-quality SVG icons for you to use in your python projects
Features
- 5237 free MIT-licensed high-quality SVG icons
- Load icons into Pillow Image with custom size, color, and stroke width
- Supports IDE autocompletion
- Works cross-platform without any extra dependencies
- Easy to use with
Pillow,PyQt5,PyQt6,PySide2,PySide6,Tkinter, etc.
Installation
pip install pytablericons
Usage
Import TablerIcons and call the static load() method with the desired OutlineIcon or FilledIcon:
from pytablericons import TablerIcons, OutlineIcon, FilledIcon
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE) # Outline icon
icon_check = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Filled icon
NOTE:
The icon names are the same as on the tabler-icons.io site, except every letter is uppercase and hyphens are replaced with underscores.
Examples:rotate→ROTATE,arrow-down-right→ARROW_DOWN_RIGHT
Customization
Setting a custom size, color, and stroke width:
# Width and height 100px (default: 24)
icon_custom_size = TablerIcons.load(OutlineIcon.ROTATE, size=100)
# Color red (default: '#FFF')
icon_custom_color = TablerIcons.load(OutlineIcon.ROTATE, color='#ff0000')
# Stroke width 1.5 (default: 2.0)
icon_custom_stroke_width = TablerIcons.load(OutlineIcon.ROTATE, stroke_width=1.5)
# Combining everything
icon_custom = TablerIcons.load(OutlineIcon.ROTATE, size=100, color='#ff0000', stroke_width=1.5)
NOTE:
The color can either be a hex color or one of very limited color names.
Examples:'#ec3440','#581790','red','green','blue'
Examples
- Using an icon with Pillow:
from pytablericons import TablerIcons, FilledIcon
icon = TablerIcons.load(FilledIcon.CIRCLE_CHECK) # Load icon
icon.show() # Show icon
print(icon.size) # Print icon size
- Using an icon with PyQt6:
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QMainWindow, QPushButton
from pytablericons import TablerIcons, OutlineIcon
class Window(QMainWindow):
def __init__(self):
super().__init__(parent=None)
# Load icon
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE, color='#000')
# Create button with icon
self.button = QPushButton(self)
self.button.setText('Rotate')
self.button.setIcon(QIcon(icon_rotate.toqpixmap()))
- Using an icon with Tkinter:
from PIL import ImageTk
from tkinter import Tk, Button
from tkinter.constants import *
from pytablericons import TablerIcons, OutlineIcon
# Create window
root = Tk()
# Load icon and convert to ImageTk
icon_rotate = TablerIcons.load(OutlineIcon.ROTATE, size=16, color='#000', stroke_width=3.0)
icon_rotate_tk_image = ImageTk.PhotoImage(icon_rotate)
# Create button with icon
button = Button(root, text='Rotate', image=icon_rotate_tk_image, compound=LEFT)
button.pack(padx=50, pady=25)
# Run event loop
root.mainloop()
More in-depth examples can be found in the examples folder.
Preview
Outline version (4577 icons)
Filled version (660 icons)
Tests
Installing the required test dependencies pytest and coveragepy:
pip install pytest coverage
To run the tests with coverage, clone this repository, go into the main directory and run:
coverage run -m pytest
coverage report --ignore-errors -m
License
This software is licensed under the MIT license.
Metadata
Release files for pytablericons 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytablericons-1.0.1.tar.gz | 612.9 kB | Without provenance | Details for pytablericons-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytablericons-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pytablericons-1.0.1-py3-none-any.whl |
Total release size: 3.3 MB
Release files / pytablericons-1.0.1.tar.gz
| Download URL | pytablericons-1.0.1.tar.gz |
|---|---|
| Size | 612.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad464c0e9227dd2b9d62aea3f89920af8cdbddcdd353a862f2b97f4783fe7842
|
|
BLAKE2b-256 checksum How to use checksums |
f96957f53db042e2b6d146836b3c1025cd8d3dffa471a7a401b2b5cba20940fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Release files / pytablericons-1.0.1-py3-none-any.whl
| Download URL | pytablericons-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c9bac8a016daa912273f22911d5d7039bafbb2de0a78a7152944a3aaaaa7b29
|
|
BLAKE2b-256 checksum How to use checksums |
edbbf60a5f984bafea9cf3e424a8da53214d4750cf77d908da68a54409dbd438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Security for pytablericons 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.