Apr-25-2020, 08:08 PM
Hello i made simple code like this with PyQt5. While my function is counting my GUI is not responding.
Please can somebody show me how to change this code to get it work with that "Threads" thing ?
Also i noticed this same issue happens to me when i use time.sleep( ). While my program is "sleeping" my QUI is not responding. What i am missing guys ?
THANK YOU !
Please can somebody show me how to change this code to get it work with that "Threads" thing ?
Also i noticed this same issue happens to me when i use time.sleep( ). While my program is "sleeping" my QUI is not responding. What i am missing guys ?
THANK YOU !
import sys from PyQt5 import QtWidgets from PyQt5.QtWidgets import * class Window(QMainWindow): def __init__(self): super().__init__() self.setFixedSize(300, 300) self.move(100,100) self.setWindowTitle("Hello") self.label = QLabel(self) self.label.setText("Not done") self.label.resize(400,500) self.label.move(0,5) self.b1 = QtWidgets.QPushButton(self) self.b1.setText("Count") self.b1.move(100, 120) self.b1.resize(130, 32) self.b1.clicked.connect(self.Count) self.show() def Count(self): self.i = 0 while self.i != 50000000: self.i +=1 self.label.setText("DONE") if __name__ == "__main__": app = QApplication(sys.argv) window = Window() sys.exit(app.exec())
My github:
https://github.com/Samuel-Bachorik
https://github.com/Samuel-Bachorik