PyQt5 加载gif动画
#! /usr/bin/env python
# -*- coding:utf-8 -*-
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon, QMovie
from PyQt5.QtCore import Qt
import sys
class M_Win(QWidget):
def __init__(self):
super().__init__()
self.m_ui()
def m_ui(self):
self.resize(950, 200)
self.setWindowIcon(QIcon("./icon/title.png"))
self.setWindowTitle("加载gif动画")
self.label_01()
def label_01(self):
self.label = QLabel(self)
self.label.setToolTip("这是一个标签")
self.m_movie()
def m_movie(self):
movie = QMovie("./images/bg.gif")
self.label.setMovie(movie)
movie.start()
if __name__ == "__main__":
app = QApplication(sys.argv)
win = M_Win()
win.show()
sys.exit(app.exec_())