setupUi() creates all the required graphical components for the GUI. reportProgress ( i + 1 ) app = QApplication ( sys. setText ( f "Counting: " ) def runLongTask ( self ): """Long-running task in 5 steps.""" for i in range ( 5 ): sleep ( 1 ) self. setLayout ( layout ) def countClicks ( self ): self. runLongTask ) # Set the layout layout = QVBoxLayout () layout. longRunningBtn = QPushButton ( "Long-Running Task!", self ) self. countBtn = QPushButton ( "Click me!", self ) self. stepLabel = QLabel ( "Long-Running Step: 0" ) self. clicksLabel = QLabel ( "Counting: 0 clicks", self ) self. centralWidget ) # Create and connect widgets self. Import sys from time import sleep from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( QApplication, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget, ) class Window ( QMainWindow ): def _init_ ( self, parent = None ): super ().
0 Comments
Leave a Reply. |