*** GMX Spamverdacht *** Re: [PyQt] ImportError: No module named QtOpenGL

Phil Thompson phil at riverbankcomputing.co.uk
Sun Apr 29 11:05:52 BST 2007


On Sunday 29 April 2007 5:25 am, Andreas Pakulat wrote:
> On 28.04.07 21:13:38, sole at esrf.fr wrote:
> > Quoting Andreas Pakulat <apaku at gmx.de>:
> > > On 28.04.07 23:31:53, Pradnyesh Sawant wrote:
> > > > Hello,
> > > > I've written a small pyqt4 code, which on running on an ubuntu 6.10
> > > > system gives me the foll error:
> > > > $ python2.4 updLbl.py
> > > > Traceback (most recent call last):
> > > >  File "updLbl.py", line 1, in ?
> > > >    import PyQt4.Qt as qt
> > >
> > > This is wrong, you don't want to do that.
> >
> > That is not wrong. It just forces him to have all the packages installed
> > and it is never wrong if he builds PyQt4 himself because Qt.py would only
> > try to import the modules he built.
>
> If it forces him to install all pyqt4 packages, even the ones he doesn't
> want to use then using this import is wrong.

No, it's a question of choice.

> > In his current situation he could even comment the
> >
> > "from PyQt4.QtOpenGL import *"
> >
> > line of Qt.py if he does not intend to use OpenGL.
>
> Which means changing a system file which is a bad thing to do. Other
> software may rightfully rely on having that line there and he has to do
> that change every time he updates his PyQt4 packages.
>
> > By other hand I find pretty convenient not to have to care about if a
> > module or a constant comes from QtCore or from QtGui, specially if I am
> > porting PyQt3 code to PyQt4 because minimizes changes. I guess that was
> > one of the main motivations to have Qt.py as part of the standard
> > installation. Afterwards it is just a question of taste :)
>
> Right, the motivation for the Qt.py package is simply convenience for
> porting PyQt3 code. Which doesn't mean you should use it in new PyQt4
> programs. Using something like this creates enough convience while
> preserving a clean global namespace:

The motivation for the Qt package is to give the developer the choice of 
different styles. As the documentation says, it's a matter of personal taste 
and neither right nor wrong.

> from PyQt4 import QtCore,QtGui
> from PyQt4.QtGui import QWidget, QPushButton <other classes you use very
> often>
>
> Andreas

Phil


More information about the PyQt mailing list