PyQt widget consists of textless QLabel which has svg image as an icon on the left and text included QLabel on the right.
This module is useful to set the icon included title bar.
- PyQt5 >= 5.8
python -m pip install pyqt-svg-icon-text-widget
setSvgFile(filename: str)
to set svg filesetText(text: str)
to set text
Svg icon QLabel
's maximum height is set according to text included QLabel
's font height.
Code Sample
from PyQt5.QtWidgets import QApplication
from pyqt_svg_icon_text_widget import SvgIconTextWidget
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = SvgIconTextWidget()
ex.setSvgFile('ico/dark-notepad.svg')
ex.setText('Dark Notepad')
ex.show()
sys.exit(app.exec_())
Result