标题已经说得很清楚了。
假设我有一个简单的应用程序:
main.py >>>
现在这个例子运行良好。但是假设我在main.qml中打错字,我把"height"写成了"heigth"。那么Python代码将继续工作,但会启动一个没有任何错误信息的空窗口。
我该怎么做才能在Python控制台中看到.qml文件中的错误?在6000行代码中找错太痛苦了。
我正在使用PyQt 5.5.1、Anaconda 2.4.1(Python 3.5.1)、Windows 8.1。
假设我有一个简单的应用程序:
main.py >>>
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView
# Main Function
if __name__ == '__main__':
# Create main app
myApp = QApplication(sys.argv)
# Create a label and set its properties
appLabel = QQuickView()
appLabel.setSource(QUrl('main.qml'))
# Show the Label
appLabel.show()
# Execute the Application and Exit
myApp.exec_()
sys.exit()
main.qml >>>
import QtQuick 2.0
Rectangle {
width: 250; height: 175
Text {
id: helloText
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
text: "Hello World!!!\n Traditional first app using PyQt5"
horizontalAlignment: Text.AlignHCenter
}
}
现在这个例子运行良好。但是假设我在main.qml中打错字,我把"height"写成了"heigth"。那么Python代码将继续工作,但会启动一个没有任何错误信息的空窗口。
我该怎么做才能在Python控制台中看到.qml文件中的错误?在6000行代码中找错太痛苦了。
我正在使用PyQt 5.5.1、Anaconda 2.4.1(Python 3.5.1)、Windows 8.1。