Skip to content Skip to sidebar Skip to footer

How Do I Call An Gui Object Or More From Main Class

I have a gui application I put text into text box1, text box2,and then click on the pushButton, The function return_text_username () in the moduel_b.py be called. Now I can call o

Solution 1:

You don't need to define lambda function for each slot, instead group them into one and pass it to your connect method, this way:

txt1 = self.ui.lineEdit.text #Method reference not Method call
txt2 = self.ui.lineEdit2.text 
mySlot = lambda : (instance_b.return_text_username(txt1()), instance_b.return_printtext_password(txt2()))# Passed to lambda method call this time
QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"),  mySlot)

As for Point-B, I think you've already managed to do it,

defreturn_text_username (self, txt):
     username=unicode(txt) 
     print username  
     return username 

Post a Comment for "How Do I Call An Gui Object Or More From Main Class"