Results 1 to 2 of 2

Thread: PyQT5 No Taskbar Details after Splash Screen

  1. #1
    Join Date
    Nov 2019
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default PyQT5 No Taskbar Details after Splash Screen

    Hello,

    I know this is a QT Forum and no specified PyQT / Python forum
    But The problem I face maybe is "so easy" but I can't see the solution

    I have this Python Code.

    First I open an QMainWindow as Splash Screen, while I load the settings, customers, sales etc..

    But When I close the Splash Screen, and open the Main Screen, the taskbar details disappeared!

    This is the code:

    Qt Code:
    1. from PyQt5.QtCore import *
    2. from PyQt5.QtWidgets import *
    3. from PyQt5.QtGui import *
    4. from PyQt5.uic import loadUiType
    5. import os
    6. import sys
    7. import time
    8.  
    9.  
    10.  
    11. class ThreadProgress(QThread):
    12. mysignal = pyqtSignal(int, str)
    13.  
    14. def __init__(self, parent=None):
    15. QThread.__init__(self, parent)
    16.  
    17. def run(self):
    18. i = 0
    19. while i < 102:
    20. time.sleep(0.02)
    21. self.mysignal.emit(i, "txt")
    22. i += 1
    23.  
    24.  
    25. FROM_SPLASH, _ = loadUiType(os.path.join(os.path.dirname(__file__), "splash.ui"))
    26. FROM_MAIN, _ = loadUiType(os.path.join(os.path.dirname(__file__), "mainwindow FRAME.ui"))
    27.  
    28.  
    29. class Main(QMainWindow, FROM_MAIN):
    30. def __init__(self, parent=None):
    31. super(Main, self).__init__(parent)
    32. self.setupUi(self)
    33.  
    34.  
    35. class Splash(QMainWindow, FROM_SPLASH):
    36. def __init__(self, parent=None):
    37. super(Splash, self).__init__(parent)
    38. QMainWindow.__init__(self)
    39. self.setupUi(self)
    40.  
    41. pixmap = QPixmap("splash_logo.png")
    42. self.splah_image.setPixmap(pixmap.scaled(350, 152))
    43.  
    44. progress = ThreadProgress(self)
    45. progress.mysignal.connect(self.progress)
    46. progress.start()
    47.  
    48. @pyqtSlot(int, str)
    49. def progress(self, i, txt):
    50. if i == 101:
    51. self.close()
    52. self.setStyleSheet("")
    53. main = Main(self)
    54. main.show()
    55. self.progressBar.setValue(i)
    56. self.SubText.setText(txt)
    57.  
    58.  
    59.  
    60. def main():
    61. app = QApplication(sys.argv)
    62. splash = Splash()
    63. splash.show()
    64.  
    65. app.exec_()
    66.  
    67.  
    68. if __name__ == '__main__':
    69. try:
    70. main()
    71. except Exception as why:
    72. print(why)
    To copy to clipboard, switch view to plain text mode 

    Can you suggest me a solution?

    Thank you very much

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: PyQT5 No Taskbar Details after Splash Screen

    I don't understand why you are using QMainWindow for the splash screen when Qt has a QSplashScreen class for this purpose. I also don't understand why you are using calls to sleep() instead of using a single-shot QTimer to control the length of time the splash screen is displayed.

    The usual scenario is:

    - Create the QSplashScreen instance
    - Create the QMainWindow instance. Do not call show() on it.
    - Tell the splash screen that it should close when the main window is shown (QSplashScreen::finish())
    - show() the splash screen
    - Create a single-shot QTimer and connect its timeout() signal to the main window's show() slot, then start the timer.
    - app.exec_()

    If loading the background data is time consuming, then instead of using a QTimer, have the data loading method call show() on the main window when it finishes. That way, the splash screen will be displayed for as long as it takes to complete loading your data.
    Last edited by d_stranz; 7th November 2019 at 19:52.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Problem with Splash Screen ?
    By vinod in forum Qt Programming
    Replies: 13
    Last Post: 11th April 2020, 18:15
  2. Independent splash screen
    By ndev in forum Qt Programming
    Replies: 3
    Last Post: 23rd September 2014, 19:52
  3. splash screen problem
    By wizarda in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2011, 03:05
  4. How to Keep Splash Screen and App on Same Display
    By ajb_advance in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 12:49
  5. Splash Screen
    By Salazaar in forum Newbie
    Replies: 27
    Last Post: 4th June 2007, 18:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.