PyIcon#

class ansys.aedt.toolkits.common.ui.utils.widgets.py_icon.py_icon.PyIcon(icon_path, icon_color='#000000')[source]#

Icon widget with customizable elements.

The icon and color can be customized during initialization.

Parameters:
icon_pathstr

Path to the icon image file.

icon_colorstr, optional

The color of the icon in hex color code. The default is "#000000".

Examples

>>> import sys
>>> from PySide6.QtWidgets import QApplication, QVBoxLayout, QPushButton
>>> from ansys.aedt.toolkits.common.ui.utils.widgets import *
>>> class Example(QWidget):
>>>     def __init__(self):
>>>         super().__init__()
>>>         layout = QVBoxLayout(self)
>>>         layout.addWidget(QPushButton("Button 1"))
>>>         layout.addWidget(PyIcon('path_to_icon.svg', "#FF0000"))
>>>         layout.addWidget(QPushButton("Button 2"))
>>> if __name__ == "__main__":
>>>     app = QApplication([])
>>>     window = Example()
>>>     window.show()
>>>     app.exec()
set_icon(icon_path, icon_color=None)[source]#

Set icon of the PyIcon widget.

The icon and color can be customized during initialization.

Parameters:
icon_pathstr

Path to the icon image file.

icon_colorstr, optional

The color of the icon in hex color code. The default is "#000000".