wxSplashScreen

Hello,

The rationale in using a splashscreen is to have some instant feedback to the user until the full program is loaded, I presume. I tried to make use of that very feature in the application below (CDriveManger creates a mainwindow and a few other objects in it). However, I have the impression that in this case it takes quite a long time to launch Python, do a lot of things until the SplashScreen comes up, followed by the application's main window. My conclusion is that my program does something wrong. Or is this normal? Any hints?

from wxPython.wx import *
from drivemanager import CDriveManager

class Cdm(wxApp):
     def OnInit(self):
         wxInitAllImageHandlers()

         bmp = wxImage("icons/splash.gif").ConvertToBitmap()

         splash = wxSplashScreen(bmp,
             wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,1000,None,-1,
             style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)
         splash.Show()

         self.DriveManager = CDriveManager (None, -1, "")
         self.SetTopWindow (self.DriveManager)
         self.DriveManager.Show (True)

         return True

if __name__ == "__main__":
     dm = Cdm()
     dm.MainLoop()

Hi Peter,

I am not sure but calling "wxYield" after "Show" might help!

hope that helps,

Thorsten

Peter Wurmsdobler wrote:

···

Hello,

The rationale in using a splashscreen is to have some instant feedback to the user until the full program is loaded, I presume. I tried to make use of that very feature in the application below (CDriveManger creates a mainwindow and a few other objects in it). However, I have the impression that in this case it takes quite a long time to launch Python, do a lot of things until the SplashScreen comes up, followed by the application's main window. My conclusion is that my program does something wrong. Or is this normal? Any hints?

from wxPython.wx import *
from drivemanager import CDriveManager

class Cdm(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()

        bmp = wxImage("icons/splash.gif").ConvertToBitmap()

        splash = wxSplashScreen(bmp,
            wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,1000,None,-1,
            style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)
        splash.Show()

        self.DriveManager = CDriveManager (None, -1, "")
        self.SetTopWindow (self.DriveManager)
        self.DriveManager.Show (True)

        return True

if __name__ == "__main__":
    dm = Cdm()
    dm.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
brainbot technologies AG boppstrasse . 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/ mailto:henni@brainbot.com

Thorsten, thanks for the feedback. Unfortunately, it still taks a few seconds until the splashscreen is visible, and only fractions of seconds for the application window to be on top afterwards.
peter

Probably it takes a long time to import the "CDriveManager".
Maybe its a good idea to start the application without importing "CDriveManager" at the beginning but after showing the Splashscreen:

from wxPython.wx import *

class Cdm(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()

        bmp = wxImage("icons/splash.gif").ConvertToBitmap()

        splash = wxSplashScreen(bmp,
            wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,1000,None,-1,
            style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)
        splash.Show()
               from drivemanager import CDriveManager

        self.DriveManager = CDriveManager (None, -1, "")
        self.SetTopWindow (self.DriveManager)
        self.DriveManager.Show (True)

        return True

if __name__ == "__main__":
    dm = Cdm()
    dm.MainLoop()

Peter Wurmsdobler wrote:

···

Thorsten, thanks for the feedback. Unfortunately, it still taks a few seconds until the splashscreen is visible, and only fractions of seconds for the application window to be on top afterwards.
peter

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
brainbot technologies AG boppstrasse . 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/ mailto:henni@brainbot.com

Peter Wurmsdobler wrote:

Hello,

The rationale in using a splashscreen is to have some instant feedback to the user until the full program is loaded, I presume. I tried to make use of that very feature in the application below (CDriveManger creates a mainwindow and a few other objects in it). However, I have the impression that in this case it takes quite a long time to launch Python, do a lot of things until the SplashScreen comes up, followed by the application's main window. My conclusion is that my program does something wrong. Or is this normal? Any hints?

It's normal, depending on platform a lot of shared libs may have to be loaded as part of the initial import. The demo actually does an artificial delay after showing the splashscreen before showing the main frame. Obviously you wouldn't want to do this in a real app, but if you do have a lot of extra initialization to do after wxPython is loaded then it would make more sense to get the spash screen up as soon as possible. You may need to call wxYield after showing it though to ensure that it gets a paint event and such before you go off and do your time consuming thing.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!