Hello,

I am looking for advice on developing PyQt QML applications. More specifically, I would like to know what setup and working mode ensures the smoothest progress.

I have been trying to write a GUI using the following:

In Eclipse IDE with PyDev, I create a new PyDev project. My main .py file launches a QML application:

Qt Code:
  1. app = QApplication(sys.argv)
  2. # Create a label and set its properties
  3. engine = QQmlApplicationEngine()
  4. engine.load(QUrl('QmlBackbone.qml'))
  5. win = engine.rootObjects()[0]
  6. win.show()
  7. sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode 
The QML application is defined in a .qml file, which I create by right-clicking my PyDev project and clicking on 'add new file'. I name this file 'QmlBackbone.qml'. When the file is created, QtCreator automatically loads up, since I have given the file a .qml extension. There I can modify the QML structure.

I launch the application from Eclipse, by running main.py. This works if there is no error in my .qml files. If there is any error, the application exits at win = engine.rootObjects()[0] (because, most probably, engine.load(QUrl('QmlBackbone.qml')) fails, so engine has not root objects), without logging any errors in QtCreator. I am left trying to guess what causes the error, which drastically amplifies the debug time.

Another disadvantage is that I do not see a Project structure in QtCreator. Thus, I can only access .qml files from the 'Open Documents' box, provided I opened them before from Eclipse.

In other words, QtCreator just works as a QML code editor - nothing else.

Additionally, if I run main.py from command line python main.py, I get the following error, which I do not get when I launch from Eclipse:

ImportError: No module named PyQt5.QtCore

I feel like my approach is completely off-track and unproductive.

How should I plan to develop a GUI using PyQt? Which tools should I use? What is the default recommended workflow? Should I create a project within QtCreator? Creating a project from QtCreator assumes I am using C++, but I am using Python.