0

我在使用 pyuic 导出我的 .py GUI 文件以按应有的方式执行时遇到了极大的困难。

目前,尽管使用了我能想到的所有变量,但我不断收到以下错误: NameError: name 'QMainWindow' is not defined

这是 GUI .py 文件:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'punchmenu.ui'
#
# Created: Mon Mar 09 19:00:14 2015
#      by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!

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_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(480, 320)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(-1, 0, 481, 301))
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
        self.tabWidget.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.tabWidget.setFont(font)
        self.tabWidget.setStyleSheet(_fromUtf8("QTabBar::scroller { /* the width of the scroll buttons */ width: 50px; } "))
        self.tabWidget.setTabPosition(QtGui.QTabWidget.North)
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setElideMode(QtCore.Qt.ElideNone)
        self.tabWidget.setUsesScrollButtons(True)
        self.tabWidget.setDocumentMode(True)
        self.tabWidget.setTabsClosable(False)
        self.tabWidget.setMovable(False)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.hometab = QtGui.QWidget()
        self.hometab.setObjectName(_fromUtf8("hometab"))
        self.label = QtGui.QLabel(self.hometab)
        self.label.setGeometry(QtCore.QRect(60, 0, 371, 231))
        self.label.setText(_fromUtf8(""))
        self.label.setPixmap(QtGui.QPixmap(_fromUtf8("vtc punch logo.jpg")))
        self.label.setObjectName(_fromUtf8("label"))
        self.label_2 = QtGui.QLabel(self.hometab)
        self.label_2.setGeometry(QtCore.QRect(10, 240, 81, 31))
        font = QtGui.QFont()
        font.setPointSize(18)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.flipscreenbutton = QtGui.QPushButton(self.hometab)
        self.flipscreenbutton.setGeometry(QtCore.QRect(150, 240, 191, 31))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.flipscreenbutton.setFont(font)
        self.flipscreenbutton.setObjectName(_fromUtf8("flipscreenbutton"))
        self.tabWidget.addTab(self.hometab, _fromUtf8(""))
        self.powertab = QtGui.QWidget()
        self.powertab.setObjectName(_fromUtf8("powertab"))
        self.groupBox_5 = QtGui.QGroupBox(self.powertab)
        self.groupBox_5.setGeometry(QtCore.QRect(10, 10, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_5.setFont(font)
        self.groupBox_5.setObjectName(_fromUtf8("groupBox_5"))
        self.restartbutton = QtGui.QPushButton(self.groupBox_5)
        self.restartbutton.setGeometry(QtCore.QRect(130, 20, 181, 111))
        font = QtGui.QFont()
        font.setPointSize(20)
        font.setBold(False)
        font.setWeight(50)
        self.restartbutton.setFont(font)
        self.restartbutton.setObjectName(_fromUtf8("restartbutton"))
        self.shutdownbutton = QtGui.QPushButton(self.groupBox_5)
        self.shutdownbutton.setGeometry(QtCore.QRect(130, 140, 181, 111))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.shutdownbutton.setFont(font)
        self.shutdownbutton.setObjectName(_fromUtf8("shutdownbutton"))
        self.tabWidget.addTab(self.powertab, _fromUtf8(""))
        self.lanipconfigtab = QtGui.QWidget()
        self.lanipconfigtab.setObjectName(_fromUtf8("lanipconfigtab"))
        self.groupBox = QtGui.QGroupBox(self.lanipconfigtab)
        self.groupBox.setGeometry(QtCore.QRect(10, 10, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox.setFont(font)
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.dhcpbutton = QtGui.QPushButton(self.groupBox)
        self.dhcpbutton.setGeometry(QtCore.QRect(10, 80, 201, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.dhcpbutton.setFont(font)
        self.dhcpbutton.setObjectName(_fromUtf8("dhcpbutton"))
        self.staticbutton = QtGui.QPushButton(self.groupBox)
        self.staticbutton.setGeometry(QtCore.QRect(250, 80, 201, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.staticbutton.setFont(font)
        self.staticbutton.setObjectName(_fromUtf8("staticbutton"))
        self.tabWidget.addTab(self.lanipconfigtab, _fromUtf8(""))
        self.wificonfigtab = QtGui.QWidget()
        self.wificonfigtab.setObjectName(_fromUtf8("wificonfigtab"))
        self.scrollArea = QtGui.QScrollArea(self.wificonfigtab)
        self.scrollArea.setGeometry(QtCore.QRect(0, 0, 481, 281))
        self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 477, 277))
        self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
        self.groupBox_9 = QtGui.QGroupBox(self.scrollAreaWidgetContents)
        self.groupBox_9.setGeometry(QtCore.QRect(0, 10, 471, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_9.setFont(font)
        self.groupBox_9.setObjectName(_fromUtf8("groupBox_9"))
        self.layoutWidget = QtGui.QWidget(self.groupBox_9)
        self.layoutWidget.setGeometry(QtCore.QRect(10, 20, 451, 241))
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.scanforaccesspointsbutton = QtGui.QPushButton(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.scanforaccesspointsbutton.setFont(font)
        self.scanforaccesspointsbutton.setObjectName(_fromUtf8("scanforaccesspointsbutton"))
        self.verticalLayout.addWidget(self.scanforaccesspointsbutton)
        self.connectwifibutton = QtGui.QPushButton(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.connectwifibutton.setFont(font)
        self.connectwifibutton.setObjectName(_fromUtf8("connectwifibutton"))
        self.verticalLayout.addWidget(self.connectwifibutton)
        self.disconnectwifibutton = QtGui.QPushButton(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.disconnectwifibutton.setFont(font)
        self.disconnectwifibutton.setObjectName(_fromUtf8("disconnectwifibutton"))
        self.verticalLayout.addWidget(self.disconnectwifibutton)
        self.erasestoredwifinetworksbutton = QtGui.QPushButton(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.erasestoredwifinetworksbutton.setFont(font)
        self.erasestoredwifinetworksbutton.setObjectName(_fromUtf8("erasestoredwifinetworksbutton"))
        self.verticalLayout.addWidget(self.erasestoredwifinetworksbutton)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.tabWidget.addTab(self.wificonfigtab, _fromUtf8(""))
        self.captivportallogintab = QtGui.QWidget()
        self.captivportallogintab.setObjectName(_fromUtf8("captivportallogintab"))
        self.webView = QtWebKit.QWebView(self.captivportallogintab)
        self.webView.setGeometry(QtCore.QRect(0, 0, 481, 271))
        self.webView.setUrl(QtCore.QUrl(_fromUtf8("http://www.briancourt.co.uk/")))
        self.webView.setZoomFactor(0.40000000596)
        self.webView.setRenderHints(QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing)
        self.webView.setObjectName(_fromUtf8("webView"))
        self.tabWidget.addTab(self.captivportallogintab, _fromUtf8(""))
        self.wifiapconfigtab = QtGui.QWidget()
        self.wifiapconfigtab.setObjectName(_fromUtf8("wifiapconfigtab"))
        self.groupBox_4 = QtGui.QGroupBox(self.wifiapconfigtab)
        self.groupBox_4.setGeometry(QtCore.QRect(10, 10, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_4.setFont(font)
        self.groupBox_4.setObjectName(_fromUtf8("groupBox_4"))
        self.tabWidget.addTab(self.wifiapconfigtab, _fromUtf8(""))
        self.vpnconfigtab = QtGui.QWidget()
        self.vpnconfigtab.setObjectName(_fromUtf8("vpnconfigtab"))
        self.groupBox_6 = QtGui.QGroupBox(self.vpnconfigtab)
        self.groupBox_6.setGeometry(QtCore.QRect(10, 10, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_6.setFont(font)
        self.groupBox_6.setObjectName(_fromUtf8("groupBox_6"))
        self.disconnectvpnbutton = QtGui.QPushButton(self.groupBox_6)
        self.disconnectvpnbutton.setGeometry(QtCore.QRect(10, 150, 211, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.disconnectvpnbutton.setFont(font)
        self.disconnectvpnbutton.setObjectName(_fromUtf8("disconnectvpnbutton"))
        self.connectvpnbutton = QtGui.QPushButton(self.groupBox_6)
        self.connectvpnbutton.setGeometry(QtCore.QRect(240, 150, 211, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.connectvpnbutton.setFont(font)
        self.connectvpnbutton.setObjectName(_fromUtf8("connectvpnbutton"))
        self.switchtotcpbutton = QtGui.QPushButton(self.groupBox_6)
        self.switchtotcpbutton.setGeometry(QtCore.QRect(240, 40, 211, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.switchtotcpbutton.setFont(font)
        self.switchtotcpbutton.setObjectName(_fromUtf8("switchtotcpbutton"))
        self.switchtoudpbutton = QtGui.QPushButton(self.groupBox_6)
        self.switchtoudpbutton.setGeometry(QtCore.QRect(10, 40, 211, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.switchtoudpbutton.setFont(font)
        self.switchtoudpbutton.setObjectName(_fromUtf8("switchtoudpbutton"))
        self.tabWidget.addTab(self.vpnconfigtab, _fromUtf8(""))
        self.statusdisplaytab = QtGui.QWidget()
        self.statusdisplaytab.setObjectName(_fromUtf8("statusdisplaytab"))
        self.lanipbox = QtGui.QGroupBox(self.statusdisplaytab)
        self.lanipbox.setGeometry(QtCore.QRect(10, 0, 461, 71))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.lanipbox.setFont(font)
        self.lanipbox.setObjectName(_fromUtf8("lanipbox"))
        self.lanipshow = QtGui.QLabel(self.lanipbox)
        self.lanipshow.setGeometry(QtCore.QRect(10, 20, 451, 41))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.lanipshow.setFont(font)
        self.lanipshow.setAlignment(QtCore.Qt.AlignCenter)
        self.lanipshow.setObjectName(_fromUtf8("lanipshow"))
        self.groupBox_2 = QtGui.QGroupBox(self.statusdisplaytab)
        self.groupBox_2.setGeometry(QtCore.QRect(10, 80, 461, 91))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_2.setFont(font)
        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
        self.wifiipshow = QtGui.QLabel(self.groupBox_2)
        self.wifiipshow.setGeometry(QtCore.QRect(10, 30, 451, 41))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.wifiipshow.setFont(font)
        self.wifiipshow.setAlignment(QtCore.Qt.AlignCenter)
        self.wifiipshow.setObjectName(_fromUtf8("wifiipshow"))
        self.groupBox_3 = QtGui.QGroupBox(self.statusdisplaytab)
        self.groupBox_3.setGeometry(QtCore.QRect(10, 180, 461, 91))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_3.setFont(font)
        self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
        self.vpnipshow = QtGui.QLabel(self.groupBox_3)
        self.vpnipshow.setGeometry(QtCore.QRect(10, 30, 451, 41))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.vpnipshow.setFont(font)
        self.vpnipshow.setAlignment(QtCore.Qt.AlignCenter)
        self.vpnipshow.setObjectName(_fromUtf8("vpnipshow"))
        self.tabWidget.addTab(self.statusdisplaytab, _fromUtf8(""))
        self.softwareupdatetab = QtGui.QWidget()
        self.softwareupdatetab.setObjectName(_fromUtf8("softwareupdatetab"))
        self.label_7 = QtGui.QLabel(self.softwareupdatetab)
        self.label_7.setGeometry(QtCore.QRect(50, 40, 311, 41))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_7.setFont(font)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.label_8 = QtGui.QLabel(self.softwareupdatetab)
        self.label_8.setGeometry(QtCore.QRect(370, 40, 121, 41))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_8.setFont(font)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.groupBox_7 = QtGui.QGroupBox(self.softwareupdatetab)
        self.groupBox_7.setGeometry(QtCore.QRect(10, 9, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_7.setFont(font)
        self.groupBox_7.setObjectName(_fromUtf8("groupBox_7"))
        self.checkforupdatebutton = QtGui.QPushButton(self.groupBox_7)
        self.checkforupdatebutton.setGeometry(QtCore.QRect(110, 90, 231, 91))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.checkforupdatebutton.setFont(font)
        self.checkforupdatebutton.setObjectName(_fromUtf8("checkforupdatebutton"))
        self.tabWidget.addTab(self.softwareupdatetab, _fromUtf8(""))
        self.devmenutab = QtGui.QWidget()
        self.devmenutab.setObjectName(_fromUtf8("devmenutab"))
        self.groupBox_8 = QtGui.QGroupBox(self.devmenutab)
        self.groupBox_8.setGeometry(QtCore.QRect(9, 10, 461, 261))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.groupBox_8.setFont(font)
        self.groupBox_8.setObjectName(_fromUtf8("groupBox_8"))
        self.closmenubutton = QtGui.QPushButton(self.groupBox_8)
        self.closmenubutton.setGeometry(QtCore.QRect(20, 40, 191, 61))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.closmenubutton.setFont(font)
        self.closmenubutton.setObjectName(_fromUtf8("closmenubutton"))
        self.iteratenewpunch = QtGui.QPushButton(self.groupBox_8)
        self.iteratenewpunch.setGeometry(QtCore.QRect(20, 180, 421, 61))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.iteratenewpunch.setFont(font)
        self.iteratenewpunch.setObjectName(_fromUtf8("iteratenewpunch"))
        self.cloneexistingpunchbutton = QtGui.QPushButton(self.groupBox_8)
        self.cloneexistingpunchbutton.setGeometry(QtCore.QRect(20, 110, 421, 61))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.cloneexistingpunchbutton.setFont(font)
        self.cloneexistingpunchbutton.setObjectName(_fromUtf8("cloneexistingpunchbutton"))
        self.restartmenubutton = QtGui.QPushButton(self.groupBox_8)
        self.restartmenubutton.setGeometry(QtCore.QRect(250, 40, 191, 61))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.restartmenubutton.setFont(font)
        self.restartmenubutton.setObjectName(_fromUtf8("restartmenubutton"))
        self.tabWidget.addTab(self.devmenutab, _fromUtf8(""))
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setSizeGripEnabled(False)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "Punch Menu", None))
        self.label_2.setText(_translate("MainWindow", "Beta 2", None))
        self.flipscreenbutton.setText(_translate("MainWindow", "Flip Screen", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.hometab), _translate("MainWindow", "Home", None))
        self.groupBox_5.setTitle(_translate("MainWindow", "Select Action", None))
        self.restartbutton.setText(_translate("MainWindow", "Restart", None))
        self.shutdownbutton.setText(_translate("MainWindow", "Shutdown", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.powertab), _translate("MainWindow", "Power", None))
        self.groupBox.setTitle(_translate("MainWindow", "Select Connection Type", None))
        self.dhcpbutton.setText(_translate("MainWindow", "DHCP (Auto)", None))
        self.staticbutton.setText(_translate("MainWindow", "Static (Manual)", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.lanipconfigtab), _translate("MainWindow", "LAN IP Config", None))
        self.groupBox_9.setTitle(_translate("MainWindow", "Select Action", None))
        self.scanforaccesspointsbutton.setText(_translate("MainWindow", "Scan for Access Points", None))
        self.connectwifibutton.setText(_translate("MainWindow", "Connect Wifi", None))
        self.disconnectwifibutton.setText(_translate("MainWindow", "Disconnect Wifi", None))
        self.erasestoredwifinetworksbutton.setText(_translate("MainWindow", "Erase Stored Wifi Networks", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.wificonfigtab), _translate("MainWindow", "Wifi IP Config", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.captivportallogintab), _translate("MainWindow", "Captive Portal Login", None))
        self.groupBox_4.setTitle(_translate("MainWindow", "Feature Not Yet Implemented", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.wifiapconfigtab), _translate("MainWindow", "Wifi A/P Config", None))
        self.groupBox_6.setTitle(_translate("MainWindow", "Select Action", None))
        self.disconnectvpnbutton.setText(_translate("MainWindow", "Disconnect VPN", None))
        self.connectvpnbutton.setText(_translate("MainWindow", "Connect VPN", None))
        self.switchtotcpbutton.setText(_translate("MainWindow", "Switch to TCP", None))
        self.switchtoudpbutton.setText(_translate("MainWindow", "Switch to UDP", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.vpnconfigtab), _translate("MainWindow", "VPN Config", None))
        self.lanipbox.setTitle(_translate("MainWindow", "LAN IP", None))
        self.lanipshow.setText(_translate("MainWindow", "IP GOES HERE", None))
        self.groupBox_2.setTitle(_translate("MainWindow", "WIFI IP", None))
        self.wifiipshow.setText(_translate("MainWindow", "IP GOES HERE", None))
        self.groupBox_3.setTitle(_translate("MainWindow", "VPN IP", None))
        self.vpnipshow.setText(_translate("MainWindow", "IP GOES HERE", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.statusdisplaytab), _translate("MainWindow", "Status Display", None))
        self.label_7.setText(_translate("MainWindow", "Current Software Version:", None))
        self.label_8.setText(_translate("MainWindow", "016", None))
        self.groupBox_7.setTitle(_translate("MainWindow", "Software Version", None))
        self.checkforupdatebutton.setText(_translate("MainWindow", "Check For Update", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.softwareupdatetab), _translate("MainWindow", "Software Update", None))
        self.groupBox_8.setTitle(_translate("MainWindow", "Select Action", None))
        self.closmenubutton.setText(_translate("MainWindow", "Close Menu", None))
        self.iteratenewpunch.setText(_translate("MainWindow", "Iterate and Deploy New Punch!", None))
        self.cloneexistingpunchbutton.setText(_translate("MainWindow", "Clone Existing Punch!", None))
        self.restartmenubutton.setText(_translate("MainWindow", "Restart Menu", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.devmenutab), _translate("MainWindow", "Dev Menu", None))

from PyQt4 import QtWebKit

我试图启动它的 .py 脚本如下:

import sys
from PyQt4.QtGui import QApplication, QDialog
from punchmenuui import *


app = QApplication(sys.argv)
window = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(window)

window.show()
sys.exit(app.exec_())

无论我在启动脚本中做什么,我都会收到一条投诉,指出某些内容定义不正确。谁能告诉我我做错了什么以及需要更改什么,以便我可以开始实际编码此 GUI 的行为?!

这不是我的第一个 python 编程项目,但它是我第一次尝试 GUI,并且使用 QT 和 pyQT。

我已经看到其他人发布了有关此问题的帖子,但是对于我的生活,一旦找到解决方案,我就无法遵循他们所做的更改以使其正常工作,并弄清楚如何将其应用于我的代码。

4

0 回答 0