Skip to content
Related Articles

Related Articles

How to make a loading gif in PyQT5?
  • Last Updated : 02 Feb, 2021

PyQt5 is a GUI toolkit which can be used to develop GUI application in Python. It provides many modules that can help to build various components of the GUI application.


pip install PyQt5

Gif Link:


  • Import module
  • Create window and labels
  • Load GIF
  • Start GIF using start() 
  • Add mechanism to stop GIF using stop()
  • Execute code



import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QMovie
from PyQt5.QtCore import Qt
class LoadingGif(object):
    def mainUI(self, FrontWindow):
        FrontWindow.resize(320, 300)
        self.centralwidget = QtWidgets.QWidget(FrontWindow)
        # Label Create
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(25, 25, 200, 200))
        self.label.setMinimumSize(QtCore.QSize(250, 250))
        self.label.setMaximumSize(QtCore.QSize(250, 250))
        # Loading the GIF = QMovie("loader.gif")
    # Start Animation
    def startAnimation(self):
    # Stop Animation(According to need)
    def stopAnimation(self):
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
demo = LoadingGif()


The gif loading screen.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :