Ich habe mit Qt angefangen und verstehe nicht ganz wie es arbeitet. Mein Code ist sehr einfach:
Code: Alles auswählen
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.uic import *
def on_click():
label.setText("hello")
app=QApplication(sys.argv)
w=loadUi("inter.ui")
button=w.findChild(QPushButton, 'pushButton')
label = w.findChild(QLabel, 'label')
button.clicked.connect(on_click)
w.show()
app.exec_()
und die Shell stürzt ab. Beim Öffnen einer neuen Shell fängt das ganze wieder von vorne an. Kann mir jemand erklären, was da los ist? Wie ist die Meldung zu verstehen? Wie kann ich das Problem beheben, ohne, dass ich jedes Mal eine neue Shell öffnen muss?QWidget: Must construct a QApplication before a QPaintDevice