PyQt, after app quit, my command line is unresponsive
Unsolved
General and Desktop
-
Hi, I have some weird behaviour that I can not understand.
I run this code "python3 ToonPi.py" from my Raspberry Pi command line.
This generates a screen with picture and button using PyQt5 and Qt5.5. When I click the button the app quits, so far so good.
However, from that point on my command line no longer works and I can not see the blinking line which I
normally see when I want to type something in. I have to reboot my RPi to try again.
Anyone have any idea on this?Below are both the py file and the QML file.
QML Fileimport QtQuick 2.3 import QtQuick.Controls 1.4 ApplicationWindow { id: window visible: true width: 800; height: 480 Rectangle { id: screen width: 800; height: 480 SystemPalette { id: activePalette } Item { width: parent.width anchors { top: parent.top; bottom: toolBar.top } Image { id: background anchors.fill: parent source: "./pics/toonback.png" fillMode: Image.PreserveAspectCrop } } Button{ x: 100 y: 100 text : "Quit" onClicked: { Qt.quit() } } Rectangle { id: toolBar width: parent.width; height: 30 color: activePalette.window anchors.bottom: screen.bottom Text { id: score anchors { right: parent.right; verticalCenter: parent.verticalCenter } text: "Score: Who knows?" } } } }
And the Python file
import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtQml import QQmlApplicationEngine def main(): engine = QQmlApplicationEngine("basic.qml") engine.quit.connect(myApp.quit) # Execute the Application and Exit myApp.exec_() # Main Function if __name__ == '__main__': # Create main app myApp = QApplication(sys.argv) sys.exit(main())