erste qt gui
Verfasst: Mittwoch 25. August 2010, 12:08
ich hab grade angefangen mch mit einer gui zu beschäftigen ich hab mit dem Qt-Desigener und pyuic folgenden script erstellt:
um das Fenster aufzurfen verwende ich diesen script:
nun gibt mir die konsole folgende fehlermeldung:
Traceback (most recent call last):
File "/media/Daten_Pogramme/editortest/start.py", line 6, in <module>
class StartQT4(QtGui.QMainWindow):
NameError: name 'QtGui' is not defined
kann mir jemand helfen schon mal daanke im vorraus
Code: Alles auswählen
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/media/Daten_Pogramme/testl.ui'
#
# Created: Di Aug 24 09:45:24 2010
# by: The PyQt User Interface Compiler (pyuic) 3.18.1
#
# WARNING! All changes made in this file will be lost!
import PyQt4
class Ui_notepad(object):
def setupUi(self, notepad):
notepad.setObjectName("notepad")
notepad.resize(800, 600)
self.centralwidget = QtGui.QWidget(notepad)
self.centralwidget.setObjectName("centralwidget")
self.button_open = QtGui.QPushButton(self.centralwidget)
self.button_open.setGeometry(QtCore.QRect(10, 0, 93, 27))
self.button_open.setObjectName("button_open")
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(110, 0, 93, 27))
self.pushButton_2.setCheckable(False)
self.pushButton_2.setChecked(False)
self.pushButton_2.setObjectName("pushButton_2")
self.editor_window = QtGui.QTextEdit(self.centralwidget)
self.editor_window.setGeometry(QtCore.QRect(140, 140, 331, 291))
self.editor_window.setObjectName("editor_window")
notepad.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(notepad)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
self.menubar.setObjectName("menubar")
notepad.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(notepad)
self.statusbar.setObjectName("statusbar")
notepad.setStatusBar(self.statusbar)
self.retranslateUi(notepad)
QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL("clicked()"), notepad.close)
QtCore.QMetaObject.connectSlotsByName(notepad)
def retranslateUi(self, notepad):
notepad.setWindowTitle(QtGui.QApplication.translate("notepad", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
self.button_open.setText(QtGui.QApplication.translate("notepad", "oeffnen", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("notepad", "schleisen", None, QtGui.QApplication.UnicodeUTF8))
Code: Alles auswählen
#! /usr/bin/python
import sys
from PyQt4 import *
from edytor import Ui_notepad
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_notepad()
self.ui.setupUi(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
Traceback (most recent call last):
File "/media/Daten_Pogramme/editortest/start.py", line 6, in <module>
class StartQT4(QtGui.QMainWindow):
NameError: name 'QtGui' is not defined
kann mir jemand helfen schon mal daanke im vorraus