Ich habe einen einfachen Bildschirm mit einer Schaltfläche erstellt, die einen anderen Bildschirm aufruft, wenn auf die Schaltfläche geklickt wird.Zwischen den Layouts wechseln
Ich habe viel gesucht. Aber ich bin immer noch nicht in der Lage, dies zu tun: ** Wie kann ich zwischen meinen 2 Layouts, So, wenn ich den Button in test.py klicken das Layout ändert sich in scherm.py **
test.py
from PyQt4 import QtCore, QtGui
import subprocess
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(400, 300)
self.Button = QtGui.QPushButton(Form)
self.Button.setGeometry(QtCore.QRect(50, 40, 261, 231))
self.Button.setObjectName(_fromUtf8("Button"))
self.Button.clicked.connect(self.fun)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(_translate("Form", "Form", None))
self.Button.setText(_translate("Form", "Button", None))
def fun(self):
subprocess.call(" scherm.py 1", shell=True)
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Form = QtGui.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())
scherm.py
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_PlaatjesScherm(object):
def setupUi(self, PlaatjesScherm):
PlaatjesScherm.setObjectName(_fromUtf8("PlaatjesScherm"))
PlaatjesScherm.resize(654, 528)
self.retranslateUi(PlaatjesScherm)
QtCore.QMetaObject.connectSlotsByName(PlaatjesScherm)
def retranslateUi(self, PlaatjesScherm):
PlaatjesScherm.setWindowTitle(_translate("PlaatjesScherm", "Plaatjes", None))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
PlaatjesScherm = QtGui.QWidget()
ui = Ui_PlaatjesScherm()
ui.setupUi(PlaatjesScherm)
PlaatjesScherm.show()
sys.exit(app.exec_())