Your main program adapted with markers showing where:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from t_transfer import Ui_Dialog # <<<< Import the class the Designer built
def __init__(self, parent=None):
super(DoItNow, self).__init__(parent)
self.ui = Ui_Dialog() # <<<< Creates an instance of the class the Designer built
self.ui.setupUi(self) # <<<< Finishes initialising it
@pyqtSignature("")
def on_pushButton_clicked(self):
a = self.ui.lineEdit.text() # <<<< self.ui refers to the ui object just like in C++
self.ui.label.setText(a)
if __name__ == "__main__":
import sys
form = DoItNow() #<<<< your class is called DoItNow not Dialog
form.show()
sys.exit(app.exec_())
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from t_transfer import Ui_Dialog # <<<< Import the class the Designer built
class DoItNow(QDialog):
def __init__(self, parent=None):
super(DoItNow, self).__init__(parent)
self.ui = Ui_Dialog() # <<<< Creates an instance of the class the Designer built
self.ui.setupUi(self) # <<<< Finishes initialising it
@pyqtSignature("")
def on_pushButton_clicked(self):
a = self.ui.lineEdit.text() # <<<< self.ui refers to the ui object just like in C++
self.ui.label.setText(a)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
form = DoItNow() #<<<< your class is called DoItNow not Dialog
form.show()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
There are other ways to do the UI incorporation: http://www.riverbankcomputing.co.uk/.../designer.html
Bookmarks