Haevelin
Tripel-As
Dabei seit: 04.06.2013
Beiträge: 221
|
|
Pythoncode funktioniert nicht |
|
Folgender Code sollte nach Buch funktionieren:
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 21 09:25:36 2016
@author: rk480158
"""
import sys
from PyQt4 import QtCore, QtGui
def main(argv):
print("Hallo")
app = QtGui.QApplication(argv)
# mainwindow = QtGui.QMainWindow()
mainwindow=MainWindow()
mainwindow.show()
sys.exit(app.exec_())
main(sys.argv)
class MainWindow(QtGui.QMainWindow):
def _init_(self, *args):
QtGui.QMainWindow._init_(self, *args)
self.createMenu()
self.createComponents()
self.createLayout()
self.createConnects()
self.setWindowTitle(self.tr(u"Hello World!"))
def createMenu(self):
pass
def createComponents(self):
self.labelHalloWelt = QtGui.QLabel(self.tr(u"Hello World"))
self.buttonTextAktualisieren = QtGui.QPushButton(self.tr(u"Update!"))
self.editText = QtGui.QLineEdit()
def createConnects(self):
pass
def createLayout(self):
layoutZentral = QtGui.QVBoxLayout()
layoutZentral.addWidget(self.labelHelloWelt)
layoutZentral.addWidget(self.editText)
layoutZentral.addWidget(self.buttonTextAktualisieren)
widgetZentral = QtGui.QWidget()
widgetZentral.setLayout(layoutZentral)
self.setCentralWidget(widgetZentral)
Er tut aber nichts.
|
|