PyQT installation /configuration

David Boddie david at boddie.org.uk
Sat Jul 15 21:07:31 EDT 2006


adrian_p_smith at yahoo.com wrote:

> I've got another problem, I'm afraid - I've installed Qt 4.1.4 and PyQt
> GPL v4.0 over Python 2.4, and the demos for both run happily enough,
> but when I try to run the first example (in IDLE) from Boudewijn
> Rempt's GUI Programming with Python: QT Edition I just get
> "ImportError: No module named qt". Is there something I need to add to
> my sys.path here?

The module structures for PyQt3 and PyQt4 are quite different: the
monolithic qt module from PyQt3 has been replaced by a number of
modules in PyQt4. Despite this, there is a similar way to "import qt"
in PyQt4:

  from PyQt4 import Qt

However, you will have difficulty using the examples in that book
because it was written for PyQt3. Work is underway to "port" the book
to PyQt4, but it will take some time. (You can help with this and learn
about PyQt4 at the same time, if you want.)

In the meantime, the set of slides from a talk at EuroPython 2006 is
probably the only learning material on the web for PyQt4:

http://indico.cern.ch/contributionDisplay.py?contribId=33&sessionId=41&confId=44

There's plenty of learning material for Qt 4; the official
documentation at http://doc.trolltech.com/4.1 contains examples
and overviews that are readable if you already know C++. Those of us
who use PyQt4 are still catching up!

All the best,

David




More information about the Python-list mailing list