views:

39

answers:

1

I have a SplashScreen shown while my application loads in the background.

Unfortunately, if any errors occur during the application's initialisation a MessageBox is shown - but is behind the splash. This prevents the user from seeing the message, and from dismissing it (the only way to quit is through task manager).

Q: Is there any way of hiding the SplashScreen if any errors occur, or allowing MessageBoxes to display above it?

I am using wxPython 2.8.10.1 with Python 2.6.5 on Windows.

+1  A: 

You could try something like the following:

import wx

class MySplashScreen(wx.SplashScreen):
    # splash screen impl
    ...

class MyApp(wx.App):
    def OnInit(self):
        self.splash = MySplashScreen()
        # rest of app initialisation
        ...

app = MyApp()
try:
    app.MainLoop()
except:
    app.splash.Close()
John Keyes