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_())
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.movie_screen = QLabel(self)
self.movie_screen.setGeometry(300, 50, 500, 500)
self.setFixedSize(600, 600)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.MSWindowsFixedSizeDialogHint)
self.movie_screen.setWindowFlags(Qt.MSWindowsFixedSizeDialogHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.movie_screen.setAttribute(Qt.WA_TranslucentBackground)
self.movie = QMovie("loading.gif")
self.movie_screen.setMovie(self.movie)
self.movie.start()
if __name__ == "__main__":
qApp = QApplication([])
app = Example()
app.show()
qApp.exec()