[PyKDE] Re: PyQt4, my approach was wrong before or now?
Gerard Vermeulen
gerard.vermeulen at grenoble.cnrs.fr
Sun Mar 5 14:29:31 GMT 2006
On Sun, 05 Mar 2006 14:41:10 +0100
"V. Armando Sole" <sole at esrf.fr> wrote:
> Hi!
>
> In order to be able to use the same code with PyQt3 and PyQt4, I had
> written a small Qt4.py wrapper to simplify simple cases.
>
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
There are two namespaces Qt: one in QtCore and one in QtGui.
Qt.Vertical is part of QtCore, but this gets wiped out
by your import: from PyQt4.QtGui import *
Gerard
> QIconSet = QIcon
> QWMatrix = QMatrix
> print "Qt.Vertical = ", Qt.Vertical
> print "QSplitter = ", QSplitter
> QSplitter.Vertical = Qt.Vertical
> Qt.WDestructiveClose = Qt.WA_DeleteOnClose
> class QPopupMenu(QMenu):
> def insertItem(self, *var):
> QMenu.addAction(self,*var)
>
>
> if __name__ == "__main__":
> print "test passed"
>
>
> The goal was to be able to type:
> try:
> import Qt4 as qt
> except:
> import qt
>
> in my code in order to get the source independent of a PyQt3 or a PyQt4
> installation.
>
> My problem is the above code was working till the 20060218 snapshot
> inclusive. However, later snapshots do not allow it giving an error about
> Vertical not being an attribute of Qt. My question is if the code should
> never have worked.
>
> Thanks,
>
> Armando
>
More information about the PyQt
mailing list