PyProgress#

class ansys.aedt.toolkits.common.ui.utils.widgets.py_progress.py_progress.PyProgress(progress=0, progress_color='#ff79c6', background_color='#151617', text_color='#FFFFFF', font_size=10, font_family='Segoe UI', width=10)[source]#

A progress bar widget.

Inherits QWidget and includes customizable elements including progress, background color, progress color, and width.

Parameters:
progressfloat or int, optional

Current progress value. The default is 0.

progress_color: str, optional

Color of progress bar. The default is "#ff79c6".

background_color: str, optional

Color of background. The default is "#151617".

width: float or int

Width of the progress bar. The default is 10.

Examples

>>> import sys
>>> from PySide6.QtWidgets import *
>>> from ansys.aedt.toolkits.common.ui.utils.widgets.py_progress.py_progress import PyProgress
>>> from random import randint
>>> from PySide6.QtCore import QTimer
>>> class MyApp(QMainWindow):
...     def __init__(self):
...         super().__init__()
...         self.progress_bar = PyProgress(progress=0,
...                                        progress_color="#21252d",
...                                        background_color="#313131",
...                                        width=10)
...         timer = QTimer()
...         timer.timeout.connect(lambda: self.progress_bar.__setattr__("progress", randint(0, 100)))
...         timer.start(1000)
...         self.progress_bar.show()
...         sys.exit(app.exec())
>>> if __name__ == "__main__":
...     app = QApplication([])
...     window = MyApp()
...     sys.exit(app.exec())
paintEvent(e)[source]#

Paint the progress bar.

Parameters:
eQPaintEvent

Paint event.

property progress#

Get the current progress value.

Returns:
float or int

The current progress value.