-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
42 lines (34 loc) · 1.16 KB
/
Copy pathrun.py
File metadata and controls
42 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import sys
import time
from PyQt5.QtWidgets import QMainWindow, QSplashScreen, QApplication
from PyQt5.QtGui import QPixmap, QPainter, QMovie
from lib import main
class mywindow(QMainWindow, main.Ui_MainWindow):
def __init__(self):
super(mywindow, self).__init__()
self.setupUi(self)
class MovieSplashScreen(QSplashScreen):
def __init__(self, movie, parent=None):
movie.jumpToFrame(0)
pixmap = QPixmap(movie.frameRect().size())
QSplashScreen.__init__(self, pixmap)
self.movie = movie
self.movie.frameChanged.connect(self.repaint)
def paintEvent(self, event):
painter = QPainter(self)
pixmap = self.movie.currentPixmap()
self.setMask(pixmap.mask())
painter.drawPixmap(0, 0, pixmap)
if __name__ == '__main__':
app = QApplication(sys.argv)
movie = QMovie("style/loading.gif")
splash = MovieSplashScreen(movie)
splash.show()
splash.movie.start()
start = time.time()
while movie.state() == QMovie.Running and time.time() < start + 2:
app.processEvents()
window = mywindow()
window.show()
splash.finish(window)
sys.exit(app.exec_())