问题是,当一些数据通过internet线路到达时,事件函数被连接起来执行。但是数据是如此庞大,以至于数据在事件执行之前就出现了。连接事件功能停止,大部分数据无法实现
我尽可能简洁地修复了事件函数
from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
class AAA:
def __init__(self):
self.dict_real_contract = {}
self.test = QAxWidget('api.ctrl.1')
self.test.OnReceiveRealData.connect(self.onreceiverealdata)
def onreceiverealdata(self, input1, input2, input3):
if input1 == 'contract':
list_item_name = ['a', 'b', 'c', 'd']
lists = self.dict_real_contract.get(input1, [])
dicts = {}
for i, in list_item_name:
dicts[i] = self.api1(input2, input3)
lists.append(dicts)
self.dict_real_contract[input1] = lists
def api1(self, input2, input3):
res = self.test.dynamicCall('api1(QString, int, int)', input2, input3)
def run(self):
while True:
pass
app.QApplication(sys.argv)
temp = AAA()
temp.run()
sys.exit(app.exec_())
我使用了第三方提供的api。 “OnReceiveRealData”是一个函数,当通过通信接收到数据时执行事件。因此,在接收到数据时执行“onreceiverealdata”。 此代码的描述是等待事件。 如果收到数据,“onreceiverealdata”只需对“self.dict\u real\u contract”变量中的值进行分类。就这么简单。 在我看来,太多的数据是突然收到,所以它似乎停止前处理
目前没有回答
相关问题 更多 >
编程相关推荐