Comments (5)
PyQt has this convenience feature that when you import PyQt5.Qt
it will import all classes under the same namespace. So even if you aren't using QtQml
, it would still get imported, which I am just assuming adds to the amount of time it takes to import.
I'm sure there is reference of it in the documentation, but couldn't find it just now. This was the closest thing I found.
To solve this, I would rather find a way of only importing what the user actually imports.
from Qt import QtWidgets
# Should not import QtCore, QtQuick.. etc.
Alternatively if we test and make sure it actually does take longer, maybe it doesn't, in which case there's nothing to worry about.
from qt.py.
With current Qt.py
implementation, in function _pyqt4()
if you replace
import PyQt4.Qt
with
import PyQt4.QtCore
import PyQt4.QtGui
to avoid importing PyQt4.Qt
(and the performance hit), the following code doesn't work any more.
>>> import Qt
>>> import Qt.QtSvg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: dynamic module not initialized properly
from qt.py.
Yes, importing it all at once has been the only way I haven't run into problems. Me thinks there is some magic happening on import of the PyQt modules.
from qt.py.
This thread is interesting and somewhat related to this issue: https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038019.html
"
from foo import bar
" is equivalent to:import foo bar = foo.bar del foo
from qt.py.
This isn't solvable anymore, since 1.0, as we are explicitly importing every single member in order to map it correctly. Nor may it ever have needed a solution.
from qt.py.
Related Issues (20)
- looks like QtGui.QGuiApplication is not wrapped... HOT 1
- Table Drop Event and loadUi with PySide2 HOT 3
- Add PySide6 support HOT 20
- https://github.com/spyder-ide/qtpy/issues/348 HOT 6
- QtCompat.isValid() Not Available for All Qt Objects HOT 8
- How to add menubar in QT?
- Drop PyQt because it may be illegal to import a GPL lib from a lib under MIT HOT 1
- TypeError: Expected 4 or 5 arguments, got 3. HOT 1
- Is it possible to add support for QIdentityProxyModel HOT 1
- Change of types-PySide2 breaks Python 2 compatibility HOT 10
- TypeError: 'PySide2.QtWidgets.QWidget' called with wrong argument types
- partially initialized module 'Qt' has no attribute 'QtGui' (most likely due to a circular import)
- Convert does not convert files built with pyside2-uic 5.15.2 HOT 1
- signal.connect() TypeError in pyqt5 when signal has an argument HOT 9
- stubs missing signal.connect, disconnect and emit HOT 6
- Cannot install v1.3.8 from sdist HOT 6
- The imp module is removed with Python 3.12
- Running tests fails
- Code completion inserts references to PySide2 HOT 1
- headerToModule() is destructive when CustomWidget path is a Python . path HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt.py.