i1.py
from PyQt4 import QtCore, QtGui
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(400, 300)
self.pushButton = QtGui.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(40, 50, 75, 24))
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Form", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
from PyQt4 import QtCore, QtGui
class Ui_Form2(object):
def setupUi(self, Form):
Form2.setObjectName("Form2")
Form2.setGeometry(QtCore.QRect(0, 0, 400, 300))
self.listView = QtGui.QListView(Form2)
self.listView.setGeometry(QtCore.QRect(70, 30, 256, 192))
self.listView.setObjectName("listView")
# self.retranslateUi2(Form2)
QtCore.QMetaObject.connectSlotsByName(Form2)
def retranslateUi2(self, Form2):
Form2.setWindowTitle(QtGui.QApplication.translate("Form2", "Form2", None, QtGui.QApplication.UnicodeUTF8))
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import i1 as intr, i2 as intr2
class MyForm(QMainWindow, intr.Ui_Form):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self.connect(self.pushButton, SIGNAL("clicked()"), self.sota)
def sota(self):
self.class2 = intr2.Ui_Form2()
#QWidget.__init__(QWidget, None)
self.class2.setupUi(self.class2)
if __name__ == "__main__":
app = QApplication(sys.argv)
myapp = MyForm()
myapp.show()
sys.exit(app.exec_())