0
PyQt5 GUIのPythonスクリプト内の関数の一部として、次のコードがあります。Pyqt QtCore.QTimer().timeout.connect(self.function)エラー[1つの必須の位置引数: 'Form']
私は、コードを変更するとfunction() missing 1 required positional argument: 'Form'
:
def link_info(self, Form):
self.timer = QtCore.QTimer()
self.timer.stop
self.ip=self.lineEdit_ip.text()
self.port=int(self.lineEdit_2.text())
self.function(Form)
print('here')
self.timer.timeout.connect(self.function)
self.timer.start(5000)
私はエラーを取得しています
self.timer.timeout.connect(self.function(Form))
私はエラーを取得する:
argument 1 has unexpected type 'NoneType'
これをどのように解決できますか?あなたは、引数を必要としませんが、それでもQTimerによって後で呼び出すことができる呼び出し可能なを取得するためにlambda: self.function(Form)
またはfunctools.partial(self.function, Form)
のいずれかを使用する必要があります
おかげ