Thread operation question

Luca Bertolotti luca72.bertolotti at gmail.com
Thu Jul 3 16:02:39 BST 2025


Hello i have a question about thread management

In my project i have  define a class

Class Read(QObject):
 def __init__(self, parent=None):
        super().__init__(parent=None)

        self.timer_leggo_x_y =QTimer()
        self.timer_leggo_x_y.timeout.connect(self.leggo_x_y)
        self.timer_leggo_x_y.start(250)
 def leggo_x_y(self):
       variable = self.reader_v.read()
       self.lineEdit.setText(variable)


class Form(QWidget, Ui_Form):
    """
    Class documentation goes here.
    """

    def __init__(self, parent=None):
        """
        Constructor

        @param parent reference to the parent widget (defaults to None)
        @type QWidget (optional)
        """
         super().__init__(parent)
        self.setupUi(self)
        self.tableWidget.setRowCount(200)...........
        self.reader = .............
        self.read_pos = Read()
        self.read_pos_thread = QThread()
        self.read_pos.moveToThread(self.read_pos_thread)
        self.read_pos.reader_v = self.reader
         self.read_pos.lineEdit = self.lineEdit


My question is in order to allow speed and never have latency on the
widgets is better to add a signal in the Class Read and connect it to a def
in the Class Form and then fill the lineEdit directly in the Class Form or
leave as it is?

Thanks for your reply
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20250703/dcc7bde1/attachment.htm>


More information about the PyQt mailing list