-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
66 lines (53 loc) · 1.72 KB
/
main.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.uic import loadUiType
import os
import sys
import time
class ThreadProgress(QThread):
mysignal = pyqtSignal(int)
def __init__(self, parent=None):
QThread.__init__(self, parent)
def run(self):
i = 0
while i<101:
time.sleep(0.1)
self.mysignal.emit(i)
i += 1
FROM_SPLASH,_ = loadUiType(os.path.join(os.path.dirname(__file__),"splash.ui"))
FROM_MAIN,_ = loadUiType(os.path.join(os.path.dirname(__file__),"main.ui"))
class Main(QMainWindow, FROM_MAIN):
def __init__(self, parent=None):
super(Main, self).__init__(parent)
self.setupUi(self)
self.pushButton.clicked.connect(self.on_click)
def on_click(self):
QMessageBox.information(self, "Omar Othman", "This code writed by Omar Othman")
class Splash(QMainWindow, FROM_SPLASH):
def __init__(self, parent = None):
super(Splash, self).__init__(parent)
QMainWindow.__init__(self)
self.setupUi(self)
pixmap = QPixmap("splash.png")
self.splah_image.setPixmap(pixmap.scaled(350, 300))
progress = ThreadProgress(self)
progress.mysignal.connect(self.progress)
progress.start()
@pyqtSlot(int)
def progress(self, i):
self.progressBar.setValue(i)
if i == 100:
self.hide()
main = Main(self)
main.show()
def main():
app=QApplication(sys.argv)
window = Splash()
window.show()
app.exec_()
if __name__ == '__main__':
try:
main()
except Exception as why:
print(why)