QApplication() ve QWidget() nasıl bağlanır?PySide/PyQt'de QApplication() ve QWidget() nesneleri nasıl bağlanır?
Bu, kopyaladığım bir örnek koddur, QApplication nesnesi ve QWidget nesnesini oluşturur, ancak iki nesne arasında hiçbir bağlantı yoktur. Oluşturulan widget hakkında PySide/PyQt denetleyicisini öğretmek için app.setWidget(did)
gibi bir şey bekledim.
# http://zetcode.com/gui/pysidetutorial/firstprograms/
# 1. PySide.QtGui is the class
import sys
from PySide import QtGui
# 2. setup the application
app = QtGui.QApplication(sys.argv)
# 3. create the widget and setup
wid = QtGui.QWidget()
wid.resize(250, 150)
wid.setWindowTitle('Simple')
# 4. Show the widget
wid.show()
# 5. execute the app
sys.exit(app.exec_())
Bunun ardındaki sihir nedir? QApplication.instance()
ve QApplication
örneği ile etkileşim: QWidget
yapmak için, çok kolay olurdu böylece