pyqt-svg-label
PyQt QLabel which supports SVG icon
This is useful to set svg icon.
If you want to use button which supports SVG icon, see pyqt-svg-icon-pushbutton.
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-svg-label
Usage
setSvgFile(filename: str)to set svg file.
Included Packages
Example
Code Sample
from PyQt5.QtWidgets import QLabel, QHBoxLayout, QApplication, QWidget
from pyqt_svg_label import SvgLabel
class IconTitleWidget(QWidget):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
iconLbl = SvgLabel()
iconLbl.setSvgFile('ico/dark-notepad.svg')
titleLbl = QLabel()
titleLbl.setText('Dark Notepad')
# get the point size of the titleLbl's font
title_lbl_size = titleLbl.font().pointSize()
# to match the iconLbl's size with titleLbl's font size (usually double size is appropriate)
iconLbl.setFixedSize(title_lbl_size * 2, title_lbl_size * 2)
lay = QHBoxLayout()
lay.addWidget(iconLbl)
lay.addWidget(titleLbl)
self.setLayout(lay)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = IconTitleWidget()
ex.show()
sys.exit(app.exec_())
Result
If iconLbl.setFixedSize(title_lbl_size * 2, title_lbl_size * 2) is not included in the code sample, size of svg icon will be adjusted to fit the size of the window.
See Also
Metadata
Release files for pyqt-svg-label 0.0.13
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 |
|---|---|---|---|---|
| pyqt-svg-label-0.0.13.tar.gz | 2.9 kB | Without provenance | Details for pyqt-svg-label-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyqt_svg_label-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for pyqt_svg_label-0.0.13-py3-none-any.whl |
Total release size: 6.4 kB
Release files / pyqt-svg-label-0.0.13.tar.gz
| Download URL | pyqt-svg-label-0.0.13.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d29fb8666e3ad7ac4ebf056b54a7691d38c37fd21c9bfd03f7d454244aa1161
|
|
BLAKE2b-256 checksum How to use checksums |
c7cc795310b091d516a2e5b74046953d94aeeb67f8e5f14ce88b42cf45e3b75e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|
Release files / pyqt_svg_label-0.0.13-py3-none-any.whl
| Download URL | pyqt_svg_label-0.0.13-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6a4645c8f5ed5f72c296ee1fa381ace34f4c5c8126fbc8d86f2cc6c44e5fd4a
|
|
BLAKE2b-256 checksum How to use checksums |
177abbacfeddb064de3f23f078ec5a98adffb5a23d0d2b76cdd615f3d59cb335
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/0.0.0 CPython/3.7.6
|
Security for pyqt-svg-label 0.0.13
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.