import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class Application(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(300, 300, 200, 400)
self.splash_screen()
def splash_screen(self):
self.label_loading = QLabel(self)
self.label_loading.setAlignment(Qt.AlignCenter)
self.label_loading.setGeometry(0, 100, 200, 300)
self.movie = QMovie("loading.gif")
self.label_loading.setMovie(self.movie)
self.start_animation = QPushButton("Запустить анимацию", self)
self.start_animation.clicked.connect(self.start)
self.start_animation.setGeometry(0, 0, 150, 40)
self.stop_animation = QPushButton("Остановить анимацию", self)
self.stop_animation.clicked.connect(self.stop)
self.stop_animation.setGeometry(0, 40, 150, 40)
def start(self):
self.movie.start()
def stop(self):
self.movie.stop()
if __name__ == '__main__':
app = QApplication(sys.argv)
application = Application()
application.show()
sys.exit(app.exec_())