2017-04-03 41 views
0

PyQt5 Gui의 python 스크립트 내부 함수의 일부로 다음 코드가 있습니다.Pyqt QtCore.QTimer() .timeout.connect (self.function) error [필수 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'

어떻게 해결할 수 있습니까? 당신은 여전히 ​​인수를 필요로하지 않는 호출 가능한을 얻을 수 lambda: self.function(Form) 또는 functools.partial(self.function, Form)을 사용해야하지만 것

감사

답변

1

는 QTimer에 의해 나중에 호출 할 수 있습니다.