我已经使用 pyuic4 将 .ui 文件转换为 .py 文件。但是当我在 python 中运行代码时,什么都没有发生。没有错误,没有用户界面。代码运行并在一秒钟内结束。我尝试使用打印命令进行调试,python 没有进入def setupUi(self, Frame):
或者def retranslateUi(self, Frame):
我做错了什么?谢谢你的帮助。
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'web.ui'
#
# Created: Mon Dec 29 08:39:41 2014
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
import sys
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_Frame(object):
def setupUi(self, Frame):
Frame.setObjectName(_fromUtf8("Frame"))
Frame.resize(562, 525)
Frame.setFrameShape(QtGui.QFrame.StyledPanel)
Frame.setFrameShadow(QtGui.QFrame.Raised)
self.webView = QtWebKit.QWebView(Frame)
self.webView.setGeometry(QtCore.QRect(0, 60, 561, 461))
self.webView.setUrl(QtCore.QUrl(_fromUtf8("about:blank")))
self.webView.setObjectName(_fromUtf8("webView"))
self.pushButton = QtGui.QPushButton(Frame)
self.pushButton.setGeometry(QtCore.QRect(460, 20, 75, 23))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.lineEdit = QtGui.QLineEdit(Frame)
self.lineEdit.setGeometry(QtCore.QRect(70, 30, 351, 20))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.retranslateUi(Frame)
QtCore.QMetaObject.connectSlotsByName(Frame)
def retranslateUi(self, Frame):
Frame.setWindowTitle(_translate("Frame", "Frame", None))
self.pushButton.setText(_translate("Frame", "PushButton", None))
from PyQt4 import QtWebKit