有时候我们在执行槽函数的之后会发现这个槽函数执行两次例如下图
其实这种情况主要是没有加装饰器,在对应的函数上添加装饰器即可
@pyqtSlot()
def on_send_clicked(self):
textstr = self.lineEdit.text()
self.textBrowser.append(textstr)
print(textstr)
@pyqtSlot()就是槽函数装饰器
其实这种情况主要是没有加装饰器,在对应的函数上添加装饰器即可
@pyqtSlot()
def on_send_clicked(self):
textstr = self.lineEdit.text()
self.textBrowser.append(textstr)
print(textstr)
@pyqtSlot()就是槽函数装饰器