Skip to content

Can't stop in subthread's breakpoint when debugging. #474

@MyronCodes

Description

@MyronCodes

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions