-
Notifications
You must be signed in to change notification settings - Fork 183
Closed
Description
This is the test code.
The Thread class is a sub thread.
When I make a breakpoint in app = QApplication(sys.argv). I can stop when I debugging.
But when the breakpoint is in Thread's def run(self): , then code will run and print but didn't stop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----- ----- ----- ----- ----- <[ Sys ]> ----- ----- ----- ----- ----- #
import os
import sys
import time
import pynput
# ----- ----- ----- ----- ----- <[ PyQt5 ]> ----- ----- ----- ----- ----- #
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class Thread(QThread):
qt_signal = pyqtSignal(str)
def __init__(self, parent = None):
super().__init__(parent)
print('Thread init')
def run(self):
time.sleep(1)
for i in range(10):
print('Thread run')
class Basic(QMainWindow):
def __init__(self):
super().__init__()
self.sub = Thread()
self.sub.start()
app = QApplication(sys.argv)
ui = Basic()
sys.exit(app.exec_())
Metadata
Metadata
Assignees
Labels
No labels