[PyQt] A Qt error pushed me out of Python
phil at riverbankcomputing.co.uk
Fri Apr 13 23:37:24 BST 2007
On Friday 13 April 2007 8:36 pm, Giovanni Bajo wrote:
> On 13/04/2007 19.45, Matt Newell wrote:
> > 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.
> > 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.
> Yes, but the point is that, since PyQt 4.2, the event loop is always
> running in *background* at the interpreter prompt. So you can construct a
> complex widget, show() it and interact with it without ever calling exec()
> explicitly. It's much handier for quick sessions.
> This new feature didn't make it to the NEWS file though. I guess Phil
> didn't think it was important enough.
That's right. It comes dangerously close to being an IDE, and I never use
More information about the PyQt