├── README.md ├── main.py ├── main.ui ├── splash_screen.ui ├── ui_main.py └── ui_splash_screen.py /README.md: -------------------------------------------------------------------------------- 1 | # Splash Screen Python PySide2/PyQt5 - MODERN GUI 2 | ![Capa](https://user-images.githubusercontent.com/60605512/89593731-479c3d80-d826-11ea-8788-905a9b09f4ae.png) 3 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## 3 | ## BY: WANDERSON M.PIMENTA 4 | ## PROJECT MADE WITH: Qt Designer and PySide2 5 | ## V: 1.0.0 6 | ## 7 | ################################################################################ 8 | 9 | import sys 10 | import platform 11 | from PySide2 import QtCore, QtGui, QtWidgets 12 | from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent) 13 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient) 14 | from PySide2.QtWidgets import * 15 | 16 | ## ==> SPLASH SCREEN 17 | from ui_splash_screen import Ui_SplashScreen 18 | 19 | ## ==> MAIN WINDOW 20 | from ui_main import Ui_MainWindow 21 | 22 | ## ==> GLOBALS 23 | counter = 0 24 | 25 | # YOUR APPLICATION 26 | class MainWindow(QMainWindow): 27 | def __init__(self): 28 | QMainWindow.__init__(self) 29 | self.ui = Ui_MainWindow() 30 | self.ui.setupUi(self) 31 | 32 | # MAIN WINDOW LABEL 33 | QtCore.QTimer.singleShot(1500, lambda: self.ui.label.setText("THANKS FOR WATCHING")) 34 | QtCore.QTimer.singleShot(1500, lambda: self.setStyleSheet("background-color: #222; color: #FFF")) 35 | 36 | 37 | # SPLASH SCREEN 38 | class SplashScreen(QMainWindow): 39 | def __init__(self): 40 | QMainWindow.__init__(self) 41 | self.ui = Ui_SplashScreen() 42 | self.ui.setupUi(self) 43 | 44 | ## UI ==> INTERFACE CODES 45 | ######################################################################## 46 | 47 | ## REMOVE TITLE BAR 48 | self.setWindowFlag(QtCore.Qt.FramelessWindowHint) 49 | self.setAttribute(QtCore.Qt.WA_TranslucentBackground) 50 | 51 | 52 | ## DROP SHADOW EFFECT 53 | self.shadow = QGraphicsDropShadowEffect(self) 54 | self.shadow.setBlurRadius(20) 55 | self.shadow.setXOffset(0) 56 | self.shadow.setYOffset(0) 57 | self.shadow.setColor(QColor(0, 0, 0, 60)) 58 | self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) 59 | 60 | ## QTIMER ==> START 61 | self.timer = QtCore.QTimer() 62 | self.timer.timeout.connect(self.progress) 63 | # TIMER IN MILLISECONDS 64 | self.timer.start(35) 65 | 66 | # CHANGE DESCRIPTION 67 | 68 | # Initial Text 69 | self.ui.label_description.setText("WELCOME TO MY APPLICATION") 70 | 71 | # Change Texts 72 | QtCore.QTimer.singleShot(1500, lambda: self.ui.label_description.setText("LOADING DATABASE")) 73 | QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("LOADING USER INTERFACE")) 74 | 75 | 76 | ## SHOW ==> MAIN WINDOW 77 | ######################################################################## 78 | self.show() 79 | ## ==> END ## 80 | 81 | ## ==> APP FUNCTIONS 82 | ######################################################################## 83 | def progress(self): 84 | 85 | global counter 86 | 87 | # SET VALUE TO PROGRESS BAR 88 | self.ui.progressBar.setValue(counter) 89 | 90 | # CLOSE SPLASH SCREE AND OPEN APP 91 | if counter > 100: 92 | # STOP TIMER 93 | self.timer.stop() 94 | 95 | # SHOW MAIN WINDOW 96 | self.main = MainWindow() 97 | self.main.show() 98 | 99 | # CLOSE SPLASH SCREEN 100 | self.close() 101 | 102 | # INCREASE COUNTER 103 | counter += 1 104 | 105 | 106 | 107 | 108 | if __name__ == "__main__": 109 | app = QApplication(sys.argv) 110 | window = SplashScreen() 111 | sys.exit(app.exec_()) 112 | -------------------------------------------------------------------------------- /main.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 640 10 | 480 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Roboto Thin 23 | 25 24 | 25 | 26 | 27 | MY APP - ADD HERE YOUR WIDGETS 28 | 29 | 30 | Qt::AlignCenter 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 640 42 | 21 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /splash_screen.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SplashScreen 4 | 5 | 6 | 7 | 0 8 | 0 9 | 680 10 | 400 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 0 20 | 21 | 22 | 10 23 | 24 | 25 | 10 26 | 27 | 28 | 10 29 | 30 | 31 | 10 32 | 33 | 34 | 35 | 36 | QFrame { 37 | background-color: rgb(56, 58, 89); 38 | color: rgb(220, 220, 220); 39 | border-radius: 10px; 40 | } 41 | 42 | 43 | QFrame::StyledPanel 44 | 45 | 46 | QFrame::Raised 47 | 48 | 49 | 50 | 51 | 0 52 | 90 53 | 661 54 | 61 55 | 56 | 57 | 58 | 59 | Segoe UI 60 | 40 61 | 62 | 63 | 64 | color: rgb(254, 121, 199); 65 | 66 | 67 | <strong>YOUR</strong> APP NAME 68 | 69 | 70 | Qt::AlignCenter 71 | 72 | 73 | 74 | 75 | 76 | 0 77 | 150 78 | 661 79 | 31 80 | 81 | 82 | 83 | 84 | Segoe UI 85 | 14 86 | 87 | 88 | 89 | color: rgb(98, 114, 164); 90 | 91 | 92 | <strong>APP</strong> DESCRIPTION 93 | 94 | 95 | Qt::AlignCenter 96 | 97 | 98 | 99 | 100 | 101 | 50 102 | 280 103 | 561 104 | 23 105 | 106 | 107 | 108 | QProgressBar { 109 | 110 | background-color: rgb(98, 114, 164); 111 | color: rgb(200, 200, 200); 112 | border-style: none; 113 | border-radius: 10px; 114 | text-align: center; 115 | } 116 | QProgressBar::chunk{ 117 | border-radius: 10px; 118 | background-color: qlineargradient(spread:pad, x1:0, y1:0.511364, x2:1, y2:0.523, stop:0 rgba(254, 121, 199, 255), stop:1 rgba(170, 85, 255, 255)); 119 | } 120 | 121 | 122 | 24 123 | 124 | 125 | 126 | 127 | 128 | 0 129 | 320 130 | 661 131 | 21 132 | 133 | 134 | 135 | 136 | Segoe UI 137 | 12 138 | 139 | 140 | 141 | color: rgb(98, 114, 164); 142 | 143 | 144 | loading... 145 | 146 | 147 | Qt::AlignCenter 148 | 149 | 150 | 151 | 152 | 153 | 20 154 | 350 155 | 621 156 | 21 157 | 158 | 159 | 160 | 161 | Segoe UI 162 | 10 163 | 164 | 165 | 166 | color: rgb(98, 114, 164); 167 | 168 | 169 | <strong>Created</strong>: Wanderson M. Pimenta 170 | 171 | 172 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /ui_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ################################################################################ 4 | ## Form generated from reading UI file 'mainzhbIGI.ui' 5 | ## 6 | ## Created by: Qt User Interface Compiler version 5.14.1 7 | ## 8 | ## WARNING! All changes made in this file will be lost when recompiling UI file! 9 | ################################################################################ 10 | 11 | from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, 12 | QRect, QSize, QUrl, Qt) 13 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, 14 | QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, 15 | QRadialGradient) 16 | from PySide2.QtWidgets import * 17 | 18 | 19 | class Ui_MainWindow(object): 20 | def setupUi(self, MainWindow): 21 | if MainWindow.objectName(): 22 | MainWindow.setObjectName(u"MainWindow") 23 | MainWindow.resize(640, 480) 24 | self.centralwidget = QWidget(MainWindow) 25 | self.centralwidget.setObjectName(u"centralwidget") 26 | self.verticalLayout = QVBoxLayout(self.centralwidget) 27 | self.verticalLayout.setObjectName(u"verticalLayout") 28 | self.label = QLabel(self.centralwidget) 29 | self.label.setObjectName(u"label") 30 | font = QFont() 31 | font.setFamily(u"Roboto Thin") 32 | font.setPointSize(25) 33 | self.label.setFont(font) 34 | self.label.setAlignment(Qt.AlignCenter) 35 | 36 | self.verticalLayout.addWidget(self.label) 37 | 38 | MainWindow.setCentralWidget(self.centralwidget) 39 | self.menubar = QMenuBar(MainWindow) 40 | self.menubar.setObjectName(u"menubar") 41 | self.menubar.setGeometry(QRect(0, 0, 640, 21)) 42 | MainWindow.setMenuBar(self.menubar) 43 | self.statusbar = QStatusBar(MainWindow) 44 | self.statusbar.setObjectName(u"statusbar") 45 | MainWindow.setStatusBar(self.statusbar) 46 | 47 | self.retranslateUi(MainWindow) 48 | 49 | QMetaObject.connectSlotsByName(MainWindow) 50 | # setupUi 51 | 52 | def retranslateUi(self, MainWindow): 53 | MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) 54 | self.label.setText(QCoreApplication.translate("MainWindow", u"MY APP - ADD HERE YOUR WIDGETS", None)) 55 | # retranslateUi 56 | 57 | -------------------------------------------------------------------------------- /ui_splash_screen.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ################################################################################ 4 | ## Form generated from reading UI file 'splash_screenXBSmkq.ui' 5 | ## 6 | ## Created by: Qt User Interface Compiler version 5.14.1 7 | ## 8 | ## WARNING! All changes made in this file will be lost when recompiling UI file! 9 | ################################################################################ 10 | 11 | from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, 12 | QRect, QSize, QUrl, Qt) 13 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, 14 | QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, 15 | QRadialGradient) 16 | from PySide2.QtWidgets import * 17 | 18 | 19 | class Ui_SplashScreen(object): 20 | def setupUi(self, SplashScreen): 21 | if SplashScreen.objectName(): 22 | SplashScreen.setObjectName(u"SplashScreen") 23 | SplashScreen.resize(680, 400) 24 | self.centralwidget = QWidget(SplashScreen) 25 | self.centralwidget.setObjectName(u"centralwidget") 26 | self.verticalLayout = QVBoxLayout(self.centralwidget) 27 | self.verticalLayout.setSpacing(0) 28 | self.verticalLayout.setObjectName(u"verticalLayout") 29 | self.verticalLayout.setContentsMargins(10, 10, 10, 10) 30 | self.dropShadowFrame = QFrame(self.centralwidget) 31 | self.dropShadowFrame.setObjectName(u"dropShadowFrame") 32 | self.dropShadowFrame.setStyleSheet(u"QFrame { \n" 33 | " background-color: rgb(56, 58, 89); \n" 34 | " color: rgb(220, 220, 220);\n" 35 | " border-radius: 10px;\n" 36 | "}") 37 | self.dropShadowFrame.setFrameShape(QFrame.StyledPanel) 38 | self.dropShadowFrame.setFrameShadow(QFrame.Raised) 39 | self.label_title = QLabel(self.dropShadowFrame) 40 | self.label_title.setObjectName(u"label_title") 41 | self.label_title.setGeometry(QRect(0, 90, 661, 61)) 42 | font = QFont() 43 | font.setFamily(u"Segoe UI") 44 | font.setPointSize(40) 45 | self.label_title.setFont(font) 46 | self.label_title.setStyleSheet(u"color: rgb(254, 121, 199);") 47 | self.label_title.setAlignment(Qt.AlignCenter) 48 | self.label_description = QLabel(self.dropShadowFrame) 49 | self.label_description.setObjectName(u"label_description") 50 | self.label_description.setGeometry(QRect(0, 150, 661, 31)) 51 | font1 = QFont() 52 | font1.setFamily(u"Segoe UI") 53 | font1.setPointSize(14) 54 | self.label_description.setFont(font1) 55 | self.label_description.setStyleSheet(u"color: rgb(98, 114, 164);") 56 | self.label_description.setAlignment(Qt.AlignCenter) 57 | self.progressBar = QProgressBar(self.dropShadowFrame) 58 | self.progressBar.setObjectName(u"progressBar") 59 | self.progressBar.setGeometry(QRect(50, 280, 561, 23)) 60 | self.progressBar.setStyleSheet(u"QProgressBar {\n" 61 | " \n" 62 | " background-color: rgb(98, 114, 164);\n" 63 | " color: rgb(200, 200, 200);\n" 64 | " border-style: none;\n" 65 | " border-radius: 10px;\n" 66 | " text-align: center;\n" 67 | "}\n" 68 | "QProgressBar::chunk{\n" 69 | " border-radius: 10px;\n" 70 | " background-color: qlineargradient(spread:pad, x1:0, y1:0.511364, x2:1, y2:0.523, stop:0 rgba(254, 121, 199, 255), stop:1 rgba(170, 85, 255, 255));\n" 71 | "}") 72 | self.progressBar.setValue(24) 73 | self.label_loading = QLabel(self.dropShadowFrame) 74 | self.label_loading.setObjectName(u"label_loading") 75 | self.label_loading.setGeometry(QRect(0, 320, 661, 21)) 76 | font2 = QFont() 77 | font2.setFamily(u"Segoe UI") 78 | font2.setPointSize(12) 79 | self.label_loading.setFont(font2) 80 | self.label_loading.setStyleSheet(u"color: rgb(98, 114, 164);") 81 | self.label_loading.setAlignment(Qt.AlignCenter) 82 | self.label_credits = QLabel(self.dropShadowFrame) 83 | self.label_credits.setObjectName(u"label_credits") 84 | self.label_credits.setGeometry(QRect(20, 350, 621, 21)) 85 | font3 = QFont() 86 | font3.setFamily(u"Segoe UI") 87 | font3.setPointSize(10) 88 | self.label_credits.setFont(font3) 89 | self.label_credits.setStyleSheet(u"color: rgb(98, 114, 164);") 90 | self.label_credits.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) 91 | 92 | self.verticalLayout.addWidget(self.dropShadowFrame) 93 | 94 | SplashScreen.setCentralWidget(self.centralwidget) 95 | 96 | self.retranslateUi(SplashScreen) 97 | 98 | QMetaObject.connectSlotsByName(SplashScreen) 99 | # setupUi 100 | 101 | def retranslateUi(self, SplashScreen): 102 | SplashScreen.setWindowTitle(QCoreApplication.translate("SplashScreen", u"MainWindow", None)) 103 | self.label_title.setText(QCoreApplication.translate("SplashScreen", u"YOUR APP NAME", None)) 104 | self.label_description.setText(QCoreApplication.translate("SplashScreen", u"APP DESCRIPTION", None)) 105 | self.label_loading.setText(QCoreApplication.translate("SplashScreen", u"loading...", None)) 106 | self.label_credits.setText(QCoreApplication.translate("SplashScreen", u"Created: Wanderson M. Pimenta", None)) 107 | # retranslateUi 108 | 109 | --------------------------------------------------------------------------------