Hier der Code der Interfaces:
Code: Alles auswählen
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created: Wed Sep 29 08:55:10 2010
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(542, 481)
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(410, 440, 86, 27))
self.pushButton.setObjectName("pushButton")
self.textEdit = QtGui.QTextEdit(Dialog)
self.textEdit.setGeometry(QtCore.QRect(20, 20, 471, 391))
self.textEdit.setObjectName("textEdit")
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.setnewtext)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def setnewtext(self)
self.textEdit.setText("Hallo Welt")
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "Text ändern", None, QtGui.QApplication.UnicodeUTF8))
Code: Alles auswählen
import sys
from PyQt4 import QtCore, QtGui
from testui import Ui_Dialog
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
Code: Alles auswählen
def setnewtext(self)
^
SyntaxError: invalid syntax