[PyQt] A Qt error pushed me out of Python

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Fri Apr 13 22:12:06 BST 2007


On Fri, 13 Apr 2007 21:36:40 +0200
Giovanni Bajo <rasky at develer.com> 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.

Yes, I used iqt and PyQwt to debug Qwt but the new feature relies on
the readline module which is automatically loaded by Python on Linux
(can be checked with python -E -v). 

However, it does not work with vanilla PyQt-win-gpl-4.2.
Does somebody know how to make it work on Windows?

Gerard


More information about the PyQt mailing list