The code below is a simple Python code with PyQt5 to display a GIF. I have two monitors, one is an imac 5k, and the other one is a QHD monitor. It is difficult to understand the CPU usage difference between the situations that run the Python file on different monitors. Even when I make the PyQt window full screen, the CPU usage becomes much higher. Why does this happen?
from PyQt5.QtWidgets import QApplication, QDesktopWidget, QMainWindow, QLabel
from PyQt5 import QtGui
from PyQt5.QtCore import QTimer
import sys
class gifplayer(QMainWindow):
def __init__(self):
super(gifplayer, self).__init__()
self.mainwidget = QMainWindow(self)
self.setFixedSize(480, 330)
self.center()
self.timer = QTimer(self)
self.timer.timeout.connect(self.play)
self.timer.start(2650)
self.player = QLabel(self)
self.movie = QtGui.QMovie("./test.gif")
self.player.setMovie(self.movie)
self.player.setGeometry(0, 0, 480, 330)
self.movie.start()
self.show()
def play(self):
self.movie.start() # those lines
def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
app = QApplication(sys.argv)
ex = gifplayer()
sys.exit(app.exec_())