[PyQt] A Qt error pushed me out of Python
Matt Newell
newellm at blur.com
Fri Apr 13 18:45:02 BST 2007
On Friday 13 April 2007 09:43, Gerard Vermeulen wrote:
> If you are using a version of PyQt before 4.2, you cannot really use
> PyQt widgets like this because they do not respond to events, since
> their is no event loop (you did not call yourQApplication._exec()).
> PyQwt has a module 'iqt' that fakes an event loop in combination with
> the readline module, see
> http://pyqwt.sourceforge.net/doc5/iqt-intro.html
>
> I think that PyQt-4.2 has also half the facility of faking the event
> loop: you still have to use the readline module (this is what I think,
> I did not test it) to make sure that events are handled.
>
> Anyhow, if you want to use PyQt from the interpreter, I recommend
> the use of a Python startup file as explained in iqt-intro.html.
>
> Regards -- Gerard
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
You don't need to call QApplication::exec to have an event loop. A local
event loop is created automatically whenever you call QMenu::exec,
QDialog::exec or one of the static QMessageBox methods. You still need a
QApplication of course.
Try this to see
from PyQt4 import QtGui
import sys
app = QtGui.QApplication(sys.argv)
QMessageBox.critical(None,"Hello","World")
control returns to the caller after the message box is closed.
Matt
More information about the PyQt
mailing list