[PyKDE] QtCore.Qt and QtGui.Qt

Andreas Pakulat apaku at gmx.de
Thu Mar 2 11:37:30 GMT 2006


On 02.03.06 12:09:46, Giovanni Bajo wrote:
> Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> > Up until recently I had planned (and partially implemented) the idea that
> a
> > namespace would only appear once and that any objects implemented in other
> > modules would be placed in it. In other words...
> >
> > from PyQt4 import QtCore
> > dir(QtCore)
> > from PyQt4 import QtGui
> > dir(QtCore)
> >
> > ...would give different output for each dir(). This was a pain to
> implement
> > and (I thought) more confusing for the user - I'm not saying which of
> those
> > carried the most weight.
> 
> Are you saying that this:
> 
> ---------------------------
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> 
> dir(Qt)
> ---------------------------
> 
> won't show the full Qt namespace, thus making PyQt4 unusable without the
> annoying QtCore/QtGui prefix in front of everything?

I think that's what Phil said, isn't it?
andreas at morpheus:~/xkbconfig>python

Python 2.4.2 (#1, Jan  3 2006, 21:29:15)
[GCC 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import *
[25861 refs]
>>> len(dir(Qt))
760
[29386 refs]
>>> from PyQt4.QtGui import *
^[[A[42008 refs]
>>> len(dir(Qt))
25

That's the evidence. And if I understood Phil correct, if you want a
single Qt namespace you get yourself into a lot of trouble.

Andreas

-- 
You will be Told about it Tomorrow.  Go Home and Prepare Thyself.




More information about the PyQt mailing list