I am adding a gif to my QMainWindow. I want the size of my window to match exactly the size of QMovie but my QMovie is truncated at the first place and even if use resize on that, its still not showing fully.
Here is the code :
from typing import Text
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtCore as qtc
from PyQt5 import QtGui as qtg
import sys
class MainWindow(qtw.QDialog):
def __init__(self, *arg, **kwargs):
super().__init__(*arg, **kwargs)
self.centralwidget = qtw.QWidget(self)
self.centralwidget.setObjectName("centralwidget")
self.label = qtw.QLabel(self.centralwidget)
movie = qtg.QMovie('mic_listen2.gif')
movie.setScaledSize(qtc.QSize(50,50))
self.label.setMovie(movie)
movie.start()
self.show()
if __name__ == '__main__':
app = qtw.QApplication(sys.argv)
w = MainWindow()
sys.exit(app.exec_())
Here is the gif
https://media.giphy.com/media/QGMXK7Byy6MSXKVRlc/giphy.gif
Here is my output