class ThreadCan(QThread):
update_data = pyqtSignal(str)
update_data_message = pyqtSignal(str, str)
def __init__(self):
super(ThreadCan, self).__init__()
def run(self):
global canDataAll_singular_info, canDataAll
self.started.emit()
try:
mc.get_parameter() # 调用另外类中的变量
canDataAll = can_datas.split('\n')
count = 0
while count < send_times:
count = count + 1
for i in range(len(canDataAll)):
QThread.msleep(Eachframe_Interval) # Eachframe_Interval为Myclass类中的变量
class Myclass(QWidget, systemset_improve.Ui_Dialog):
def __init__(self):
super(Myclass, self).__init__()
self.initui()
def initui(self):
self.setupUi(self)
def get_parameter(self):
global send_times, send_interval, Eachframe_Interval
send_times = int(self.lineEdit.text())
send_interval = int(self.lineEdit_2.text())
Eachframe_Interval = int(self.lineEdit_3.text())
Python中当前类获取另一个类中变量的方法
于 2024-04-15 23:09:40 首次发布