목록기타 (2)
개발 기록
[Python] QThread를 사용한 예제
PySide6에서 별도의 스레드로 작업을 오프로드하려면 QThread를 사용하면 됩니다. 이를 위해 먼저 작업을 수행할 클래스를 만들어 QThread를 서브 클래스로 만든 다음, 필요한 작업을 수행하는 run 메소드를 오버라이드합니다. 다음은 간단한 예제를 통해 별도의 스레드에서 작업을 수행하는 방법을 보여줍니다: import sys from time import sleep from PySide6.QtCore import QThread, Signal from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel, QPushButton class WorkerThread(QThread): progress = Signa..
기타
2023. 4. 4. 11:18