class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText( "<strong>WELCOME</strong> TO VOICE CHAT") # Change Texts QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> CLIENT")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> UI")) self.show() ## ==> END ## def progress(self): global counter # SET VALUE TO PROGRESS BAR self.ui.progressBar.setValue(counter) # CLOSE SPLASH SCREE AND OPEN APP if counter > 100: # STOP TIMER self.timer.stop() self.close() b() # INCREASE COUNTER counter += 1
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText("A simple speech to text software") ## SHOW ==> MAIN WINDOW ######################################################################## self.show() ## ==> END ## ## ==> APP FUNCTIONS ######################################################################## def progress(self): global counter # SET VALUE TO PROGRESS BAR self.ui.progressBar.setValue(counter) # CLOSE SPLASH SCREE AND OPEN APP if counter > 100: # STOP TIMER self.timer.stop() # SHOW MAIN WINDOW self.main = MainWindow() self.main.show() # CLOSE SPLASH SCREEN self.close() # INCREASE COUNTER counter += 1
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE title bar self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # Shadow self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(50) self.shadow.setXOffset(10) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.DropShadowFrame.setGraphicsEffect(self.shadow) # QTimer => START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # Timer in milisecond self.timer.start(45) # init description self.ui.label_description.setText( "<strong>WELLCOME</strong> TO MY APPLICATION") # Change desctiotion QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADDING</strong> DATABASE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADDING</strong> USER INTERFACE")) self.show() def progress(self): global counter # set value to progress bar self.ui.progressBar.setValue(counter) # Close splash screend adn open main screen if counter > 100: # Stop timer self.timer.stop() # show main window self.main = MainScreen() self.main.show() # Close splash window self.close() # Increment counter counter += 1
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(35) self.ui.label_description.setText( "<strong>WELCOME</strong> TO MY APPLICATION") QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> DATABASE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> USER INTERFACE")) self.show() def progress(self): global COUNTER self.ui.progressBar.setValue(COUNTER) if COUNTER > 100: self.timer.stop() self.main = Main() self.main.show() self.close() COUNTER += 1
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(35) self.ui.label_description.setText("<strong>Test</strong> Your Knowledge Here") QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("<strong>LOADING</strong> USER INTERFACE")) self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## ==> SET INITIAL PROGRESS BAR TO (0) ZERO self.progressBarValue(0) ## ==> REMOVE STANDARD TITLE BAR self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # Remove title bar self.setAttribute(QtCore.Qt.WA_TranslucentBackground ) # Set background to transparent ## ==> APPLY DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(50) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(255, 16, 72)) self.ui.circularBg.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(15) ## SHOW ==> MAIN WINDOW ######################################################################## self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## ==> ELIMINAR BARRA DE TITULOS self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## ==> EFECTO DE SOMBRA self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## ==> QTIMER self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) ## ==> TIMER EN MS self.timer.start(35) ## ==> TEXTO INICIAL self.ui.label_description.setText("<strong>BIENVENIDO</strong> ") ## ==> TEXTOS ADICIONALES QtCore.QTimer.singleShot(1500, lambda: self.ui.label_description.setText("<strong>CARGANDO</strong> DATOS")) QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("<strong>CARGANDO</strong> ENTORNO")) ## ==> MOSTRAR VENTANA PRINCIPAL self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText("A simple speech to text software") ## SHOW ==> MAIN WINDOW ######################################################################## self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(35) self.ui.label_description.setText( "<strong>Welcome</strong> to my Application") QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>Loading</strong> Database")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>Loading</strong> User Interface")) QtCore.QTimer.singleShot self.show()
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## ==> ELIMINAR BARRA DE TITULOS self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## ==> EFECTO DE SOMBRA self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## ==> QTIMER self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) ## ==> TIMER EN MS self.timer.start(35) ## ==> TEXTO INICIAL self.ui.label_description.setText("<strong>BIENVENIDO</strong> ") ## ==> TEXTOS ADICIONALES QtCore.QTimer.singleShot(1500, lambda: self.ui.label_description.setText("<strong>CARGANDO</strong> DATOS")) QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("<strong>CARGANDO</strong> ENTORNO")) ## ==> MOSTRAR VENTANA PRINCIPAL self.show() def progress(self): global counter ## ==> ASIGNAR VALOR self.ui.progressBar.setValue(counter) ## ==> CERRAR SPLASH SCREEN Y ABRIR APLICACION PRINCIPAL if counter > 100: ## ==> DETENER TIMER self.timer.stop() ## ==> MOSTRAR VENTANA PRINCIPAL self.main = MainWindow() self.main.show() ## ==> CERRAR SPLASH SCREEN self.close() ## ==> INCREMENTAR CONTADOR counter += 1
class SplashScreen(QMainWindow): """SpalshScreen-ul de inceput""" def __init__(self): QMainWindow.__init__(self) self.main_win = MainWindow() self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE TITLE BAR self.setWindowFlag(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) # DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(40) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) # INITIAL TEXT self.ui.label_loading.setText("loading...") # CHANGE LOADING DOTS QTimer.singleShot(750, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(1500, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(2250, lambda: self.ui.label_loading.setText("loading...")) QTimer.singleShot(3000, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(3750, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(4500, lambda: self.ui.label_loading.setText("loading...")) # PROGRESS BAR TIMER self.time = QTimer() self.time.timeout.connect(self.progress) self.time.start(35) self.show() def progress(self): global counter # UPDATE PROGRESS BAR self.ui.progressBar.setValue(counter) # STOP THE TIMER if counter > 100: self.time.stop() self.main_win.show() self.close() counter += 5
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>INSTANT</strong>COMPUTER VISION")) # Change Texts QtCore.QTimer.singleShot( 2000, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> DATABASE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> USER INTERFACE")) QtCore.QTimer.singleShot( 3500, lambda: self.ui.label_description.setText( "<strong>QUICKEST</strong>CV in the West")) ## SHOW ==> MAIN WINDOW ######################################################################## self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText("<strong>ĐANG TẢI</strong> NHỮNG DỮ LIỆU CẦN THIẾT") # Change Texts QtCore.QTimer.singleShot(2500, lambda: self.ui.label_description.setText("<strong>ĐANG TẢI</strong> GIAO DIỆN NGƯỜI DÙNG")) QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("<strong>ĐANG</strong> HUẤN LUYỆN")) ## SHOW ==> MAIN WINDOW ######################################################################## self.show() self.model = FuncSplash.huanLuyen(self)
def __init__(self): QMainWindow.__init__(self) self.main_win = MainWindow() self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE TITLE BAR self.setWindowFlag(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) # DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(40) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) # INITIAL TEXT self.ui.label_loading.setText("loading...") # CHANGE LOADING DOTS QTimer.singleShot(750, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(1500, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(2250, lambda: self.ui.label_loading.setText("loading...")) QTimer.singleShot(3000, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(3750, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(4500, lambda: self.ui.label_loading.setText("loading...")) # PROGRESS BAR TIMER self.time = QTimer() self.time.timeout.connect(self.progress) self.time.start(35) self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.drop_shadow_frame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText("Zinus Corp.") # Change Texts QtCore.QTimer.singleShot(1500, lambda: self.ui.label_loading.setText("Loading Database")) QtCore.QTimer.singleShot(3000, lambda: self.ui.label_loading.setText("Loading user interface")) ## SHOW ==> MAIN WINDOW ######################################################################## self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText( "<strong>WELCOME</strong> TO THE OS PROJCET") # Change Texts QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> TICTACTOE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> TEXTEDITOR")) self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.progressBarValue(0) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 120)) self.ui.circularBg.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(15) self.show()
def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE title bar self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # Shadow self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(50) self.shadow.setXOffset(10) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.DropShadowFrame.setGraphicsEffect(self.shadow) # QTimer => START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # Timer in milisecond self.timer.start(45) # init description self.ui.label_description.setText( "<strong>WELLCOME</strong> TO MY APPLICATION") # Change desctiotion QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADDING</strong> DATABASE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>LOADDING</strong> USER INTERFACE")) self.show()
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) ## UI ==> INTERFACE CODES ######################################################################## ## REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) ## DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) ## QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText("<strong>ĐANG TẢI</strong> NHỮNG DỮ LIỆU CẦN THIẾT") # Change Texts QtCore.QTimer.singleShot(2500, lambda: self.ui.label_description.setText("<strong>ĐANG TẢI</strong> GIAO DIỆN NGƯỜI DÙNG")) QtCore.QTimer.singleShot(3000, lambda: self.ui.label_description.setText("<strong>ĐANG</strong> HUẤN LUYỆN")) ## SHOW ==> MAIN WINDOW ######################################################################## self.show() self.model = FuncSplash.huanLuyen(self) ## ==> END ## ## ==> APP FUNCTIONS ######################################################################## def progress(self): global counter # SET VALUE TO PROGRESS BAR self.ui.progressBar.setValue(counter) # CLOSE SPLASH SCREE AND OPEN APP if counter > 100: # STOP TIMER self.timer.stop() # SHOW MAIN WINDOW self.log = LoginWindow(self.model) self.log.show() # CLOSE SPLASH SCREEN self.close() # INCREASE COUNTER counter += 1
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.progressBarValue(0) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 120)) self.ui.circularBg.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(15) self.show() def progress(self): global counter global jumper value = counter htmlText = """<p><span style=" font-size:68pt;">{VALUE}</span><span style=" font-size:58pt; vertical-align:super;">%</span></p>""" newHtml = htmlText.replace("{VALUE}", str(jumper)) if (value > jumper): self.ui.labelPercentage.setText(newHtml) jumper += 10 if value >= 100: value = 1.000 self.progressBarValue(value) if counter > 100: self.timer.stop() self.main = MainWindow() self.main.show() self.close() counter += 0.5 def progressBarValue(self, value): styleSheet = """ QFrame{ border-radius: 150px; background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop:{STOP_1} rgba(255, 0, 127, 0), stop:{STOP_2} rgba(120, 230, 130, 255)); } """ progress = (100 - value) / 100.0 stop_1 = str(progress - 0.001) stop_2 = str(progress) newStylesheet = styleSheet.replace("{STOP_1}", stop_1).replace("{STOP_2}", stop_2) self.ui.circularProgress.setStyleSheet(newStylesheet)
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) # ==> SET INITIAL PROGRESS BAR TO (0) ZERO self.progressBarValue(0) # ==> REMOVE STANDARD TITLE BAR self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # Remove title bar # Set background to transparent self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # ==> APPLY DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 120)) self.ui.circularBg.setGraphicsEffect(self.shadow) # QTIMER ==> START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(15) # SHOW ==> MAIN WINDOW ######################################################################## self.show() ## ==> END ## # DEF TO LOANDING ######################################################################## def progress(self): global counter global jumper value = counter # HTML TEXT PERCENTAGE htmlText = """<p><span style=" font-size:68pt;">{VALUE}</span><span style=" font-size:58pt; vertical-align:super;">%</span></p>""" # REPLACE VALUE newHtml = htmlText.replace("{VALUE}", str(jumper)) if (value > jumper): # APPLY NEW PERCENTAGE TEXT self.ui.labelPercentage.setText(newHtml) jumper += 1 # SET VALUE TO PROGRESS BAR # fix max value error if > than 100 if value >= 100: value = 1.000 self.progressBarValue(value) # CLOSE SPLASH SCREE AND OPEN APP if counter > 100: # STOP TIMER self.timer.stop() # SHOW MAIN WINDOW self.main = MainWindow() self.main.show() # CLOSE SPLASH SCREEN self.close() # INCREASE COUNTER counter += 0.5 # DEF PROGRESS BAR VALUE ######################################################################## def progressBarValue(self, value): # PROGRESSBAR STYLESHEET BASE styleSheet = """ QFrame{ border-radius: 150px; background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop:{STOP_1} rgba(255, 0, 127, 0), stop:{STOP_2} rgba(85, 170, 255, 255)); } """ # GET PROGRESS BAR VALUE, CONVERT TO FLOAT AND INVERT VALUES # stop works of 1.000 to 0.000 progress = (100 - value) / 100.0 # GET NEW VALUES stop_1 = str(progress - 0.001) stop_2 = str(progress) # SET VALUES TO NEW STYLESHEET newStylesheet = styleSheet.replace("{STOP_1}", stop_1).replace("{STOP_2}", stop_2) # APPLY STYLESHEET WITH NEW VALUES self.ui.circularProgress.setStyleSheet(newStylesheet)
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE TITLE BAR self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) # TIMER START self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) # TIMER IN MILLISECONDS self.timer.start(35) # CHANGE DESCRIPTION # Initial Text self.ui.label_description.setText( "<strong>WELCOME</strong> TO MY APPLICATION") # Change Texts QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>LOADING</strong> DATABASE")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>" "LOADING</strong> USER INTERFACE")) # SHOW MAIN WINDOW self.show() # END # APP FUNCTIONS def progress(self): global counter # SET VALUE TO PROGRESS BAR self.ui.progressBar.setValue(counter) # CLOSE SPLASH SCREE AND OPEN APP if counter > 100: # STOP TIMER self.timer.stop() # SHOW MAIN WINDOW # ADD FURTHER from home import main # CLOSE SPLASH SCREEN self.close() main() # INCREASE COUNTER counter += 1