[PyQt] Using PyQt within an application

andYpsilon andreasfrickinger at me.com
Sun Aug 17 19:05:32 BST 2008


Hi David!

Using only app.exec_() solves the problem that it closes down the
application. Sorry for that...what a newbie mistake ;-) Thanx alot for your
help!!

But do you know a way to use the Dialog interactively with the application?
As I already mentioned the application crashes when using it while the main
event loop of the dialog is running. I'm not sure if this is a bug of the
application or something which can be fixed in the Dialog code.?

regards,
andy



David Boddie wrote:
> 
> On Sun Aug 17 15:14:32 BST 2008, andYpsilon wrote:
> 
>> Theres nothing special to the code I am using. It's what is coming out of
>> Designer, modified for having the functionality I need.
>>
>> starter is the function I call to start my dialog:
>>
>> ...
>>
>> class MeinDialog(QtGui.QDialog, Dlg):
>>     def __init__(self):
>>         QtGui.QDialog.__init__(self)
>>         self.setupUi(self)
>>
>> def starter():
>>     app = QtGui.QApplication(sys.argv)
>>     dialog = MeinDialog()
>>     dialog.setModal(False)
>>     dialog.show()
>>     sys.exit(app.exec_())
> 
> sys.exit() will cause Python to exit. If this isn't what you want, just
> call app.exec_() and Python will continue running after the PyQt stuff
> has finished.
> 
>> ...
>>
>> in the interface class this is the SIGNAL I am using to quit with a
>> button:
>>
>> ...
>>         self.retranslateUi(Dialog)
>>
>> QtCore.QObject.connect(self.pushButton,QtCore.SIGNAL("clicked()"),self.clos
>>e) QtCore.QMetaObject.connectSlotsByName(Dialog)
> 
> Using self.close is fine here. I was a bit worried that you were calling
> qApp.quit() or something.
> 
> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-PyQt-within-an-application-tp18988310p19021965.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list