PDA

View Full Version : PyQt4 connect() problem



Speakers
1st March 2018, 14:20
Hello I'm a student who study computer sciences in Brussels, apologize for my english i'm gonna try to speak clearly as I can.

I'm making some test in PyQt4 with Qt Designer to understand how the GUI works.


In Qt Designer, I put on the window:

- PushButton
- QLineEdit

Then I convert my .ui file to a .py file, my goal is to print the QLineEdit value by clicking in the PushButton, so what I have done it's:

1) I have write the function

def myfunction(self, QLineEdit):
print(self.QLineEdit)

2) In the retranslateUi(self,Form) function I add the line:

self.pushButton.clicked.connect(self.myfunction(se lf.QLineEdit))


I got the message error:
self.pushButton.clicked.connect(self.myfunction(se lf.QLineEdit))
TypeError: connect() slot argument should be a callable or a signal, not 'NoneType'

Can someone explain me about that? I'm missing something? Thanks a lot guys and have a good day.