赞
踩
使用QMoive方法实现
导入库文件
- from PyQt5 import QtCore, QtGui, QtWidgets
- from PyQt5.QtGui import QMovie
创建一个带label控件的窗口,label作为GIF的显示窗体
- class Ui_Form(object):
- def setupUi(self, Form):
- Form.setObjectName("Form")
- Form.resize(517, 361)
- self.label = QtWidgets.QLabel(Form)
- self.label.setGeometry(QtCore.QRect(0, 0, 500, 300))
- self.label.setObjectName("label")
- self.retranslateUi(Form)
- QtCore.QMetaObject.connectSlotsByName(Form)
-
- def retranslateUi(self, Form):
- _translate = QtCore.QCoreApplication.translate
- Form.setWindowTitle(_translate("Form", "Form"))
在setupUi()函数里面加入
- self.gif = QMovie('qq.gif')
- self.label.setMovie(self.gif)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。