如何从线程类python创建SetText标签

如何从线程类python创建SetText标签,python,Python,我有一个Qt图形界面。 如何从线程刷新标签文本(lbl_serial_aff) 在主文件MainProg.py中,我有一个启动线程(ComWatcher)以扫描串行端口的函数: def RS232_RD_parametres_2(self): print('*** DEBUT *** RS232_RD_parametres 2 \r\n') watcher = ComWatcher() watcher.start() 在Thread.py中 import thread

我有一个Qt图形界面。 如何从线程刷新标签文本(lbl_serial_aff)

在主文件MainProg.py中,我有一个启动线程(ComWatcher)以扫描串行端口的函数:

def RS232_RD_parametres_2(self):
    print('*** DEBUT *** RS232_RD_parametres 2 \r\n')
    watcher = ComWatcher()
    watcher.start()
在Thread.py中

import thread
import threading
import time
import serial
import tuto_form4

from tuto_form4 import *
from globalvar import *

class ComWatcher(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.running = False
        port = serial.Serial("/dev/ttyUSB0", baudrate=19200,  timeout=0.0) #
        print('start') 

    def run(self):
        global rd_parametre
        print('run')

        #tuto_formMain.self.aaa()
        #self.lbl_serial_aff.setText("None")

        """Le code que le thread devra exécuter."""
        port = serial.Serial("/dev/ttyUSB0", baudrate=19200,  timeout=0.0) #
        self.running = True
        while self.running:
            [.....]

    def stop(self):
        self.running = False
如何更改标签文本和图形界面中的所有内容

lbl_serial_aff.setText("None")
谢谢