Files
superqt/docs/utilities/fonticon.md
2023-09-12 11:24:55 -04:00

2.8 KiB

Font icons

The superqt.fonticon module provides a set of utilities for working with font icons such as Font Awesome or Material Design Icons.

Basic Example

from fonticon_fa5 import FA5S

from qtpy.QtCore import QSize
from qtpy.QtWidgets import QApplication, QPushButton

from superqt.fonticon import icon, pulse

app = QApplication([])

btn2 = QPushButton()
btn2.setIcon(icon(FA5S.smile, color="blue"))
btn2.setIconSize(QSize(225, 225))
btn2.show()

app.exec()

{{ show_widget(225) }}

Font Icon plugins

Ready-made fonticon packs are available as plugins.

A great way to search across most available icons libraries from a single search interface is to use glyphsearch: https://glyphsearch.com/

If a font library you'd like to use is unavailable as a superqt plugin, please open a feature request

Font Awesome 6

Browse available icons at https://fontawesome.com/v6/search

pip install fonticon-fontawesome6

Font Awesome 5

Browse available icons at https://fontawesome.com/v5/search

pip install fonticon-fontawesome5

Material Design Icons 7

Browse available icons at https://materialdesignicons.com/

pip install fonticon-materialdesignicons7

Material Design Icons 6

Browse available icons at https://materialdesignicons.com/ (note that the search defaults to v7, see changes from v6 in the changelog)

pip install fonticon-materialdesignicons6

See also

superqt.fonticon is a pluggable system, and font icon packs may use the "superqt.fonticon" entry point to register themselves with superqt. See fonticon-cookiecutter for a template, or look through the following repos for examples:

API

::: superqt.fonticon.icon options: heading_level: 3

::: superqt.fonticon.setTextIcon options: heading_level: 3

::: superqt.fonticon.font options: heading_level: 3

::: superqt.fonticon.IconOpts options: heading_level: 3

::: superqt.fonticon.addFont options: heading_level: 3

Animations

the animation parameter to icon() accepts a subclass of Animation that will be

::: superqt.fonticon.Animation options: heading_level: 3

::: superqt.fonticon.pulse options: heading_level: 3

::: superqt.fonticon.spin options: heading_level: 3