|
1Qter豆
我是pycharm和qtdesigner一起使用,先先用qtdesigner设计界面,然后转为python代码如下:
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(637, 369)
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(240, 250, 159, 39))
font = QtGui.QFont()
font.setPointSize(18)
self.pushButton.setFont(font)
self.pushButton.setObjectName("pushButton")
self.label = QtWidgets.QLabel(Form)
self.label.setGeometry(QtCore.QRect(20, 40, 601, 121))
self.label.setText("")
self.label.setPixmap(QtGui.QPixmap(":/url/北科大1.png"))
self.label.setObjectName("label")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "PushButton"))
import Paper_rc发现最后一行是没有意义的,我加了自己的代码使程序运行后(注释了最后一句),图片不显示,其他正常。请问是什么原因?怎么让图片显示出来呢?(我利用stylesheet加的图片,比较简单)(报酬不多请见谅)
|
|