PyQt5基础学习-加载gif动画 1.QMovie(构造动画) 2.QLabel().setMovie(组件显示动画)
首先先加载动画, 然后将加载好的动画放到组件上做显示
gitanim.py
""" 装载Gif动画 QMovie """ import sys from PyQt5.QtWidgets import QApplication, QLabel, QWidget from PyQt5.QtCore import Qt from PyQt5.QtGui import QMovie class LoadingGif(QWidget): def __init__(self): super(LoadingGif, self).__init__() self.label = QLabel("", self) self.setFixedSize(128, 128) self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint) self.movie = QMovie("../picture/loading.gif") self.label.setMovie(self.movie) self.movie.start() if __name__ == '__main__': app = QApplication(sys.argv) form = LoadingGif() form.show() sys.exit(app.exec_())
每天更新pyQt5内容