MainWindow takes 8 seconds to launch, PyQt on OsX
-
I'm used to developing with Qt and PyQt on Linux, but am now creating a hello world on OsX 10.7
My example, plus all those in the demos folder, take about 8 seconds to launch after run - a rocket icon for Python bounces in the dock for those 8 seconds before the form shows.
The rocket reports Qt 4.8.2. I am launching example from the terminal. Any tips? This delay is no good for quick development..
-
Where is the slow down; starting python, loading PyQt, or running your application?
How long does it take to start python from the command prompt?
If that doesn't take the 8 seconds, then how long does "import PyQt4" or "from PyQt4 import QtGui, QtCore" take? -
It's happening with any PyQt 4 app, including all the examples..
The mainwindow launch is just this:
@def main():
app = QApplication(sys.argv)
form = SensorDiagnostics()
form.show()
app.exec_()if name == "main":
main()@Invoking that by:
@python sensor_diagnostics.py@
-
I'm not that familiar with python, but when you said that the imports are fast, is it possible that they are delayed until you actually use something from the import? So when you imported PyQt4.QtGui but never used anything from there, python just ignored the import?
//EDIT: another thing. When you write:
@ app = QApplication(sys.argv)
form = QWidget()
form.show()
app.exec_()
app = QApplication(sys.argv)
form = QWidget()
form.show()
app.exec_()@
does it take 16 seconds? -
[quote author="syr123" date="1345443996"]Doesn't seem to take 16 seconds, and I don't think the delayed import thing is it.[/quote]
But that exactly is the indicator that it probably is the delayed import. If it wasn't, every call of those main functions should take 8 seconds. But as you see, only the first round takes that long, any subsequent ones go faster.