PyQt5.4. No window shown
-
Hi. I try a minimal PyQt5.4 app:
https://bitbucket.org/snippets/hongquan/Kond
When I run
python3 run.y
no window shows. What did I do wrong?
-
Did you get any errors when you try to run it?
The following works perfectly for me on Mac OSX 10.8, Python3.4, Qt5.4:
test.qml
import QtQuick 2.2 import QtQuick.Controls 1.1 ApplicationWindow{ width: 400 height: 300 visible: true title: qsTr("Hello") Label{ text: qsTr("Hello") anchors.centerIn: parent } }
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * from sys import argv, exit def createApplication(): app=QGuiApplication(argv) engine=QQmlApplicationEngine(app) engine.load(QUrl("test.qml")) return app if __name__=="__main__": app=createApplication() exit(app.exec_())
To execute:
$ python run.py