I am a beginner with Qt in Python.
I create simple from using Qt Designer.
1) generate python code: pyuic4 -o mygui.py mygui.ui
2) write code:
import sys
from PyQt4 import QtCore, QtGui
from mygui import Ui_MainWindow
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.abc)
def abc(self):
input = self.ui.lineEdit.text()
self.ui.label_2.setText(input)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
It works, but is possible to write QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.abc)
simpler?