Hi - I get the following "The program is still running! Do you want to kill it?" from the python IDE when I run the following splashscreen.

Any ideas on how to fix it?

#!/usr/bin/python

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id=wx.ID_ANY, title="", pos= wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE|wx.SUNKEN_BORDER):
        wx.Frame.__init__(self, parent, id, title, pos, size, style)
        self.CreateMenuBar()

    def CreateMenuBar(self):
        mb = wx.MenuBar()
        file_menu = wx.Menu()
        file_menu_settings = wx.MenuItem(file_menu, 300, 'Settings\tCtrl+S', 'Settings.', wx.ITEM_NORMAL)
        file_menu.AppendItem(file_menu_settings)
        self.Bind(wx.EVT_MENU, self.OnFileSettings, id=300)

        mb.Append(file_menu, "&File")
        self.SetMenuBar(mb)

    def OnFileSettings(self, event):
        dlg = SubclassDialog()
        dlg.ShowModal()
        dlg.Destroy()
        
class SubclassDialog(wx.Dialog):
    def __init__(self):
        wx.Dialog.__init__(self, None, -1, '', size=(800, 600))
        self.panel = wx.Panel(self, -1, size=(800, 600), pos=(0,0))
        self.CentreOnParent(wx.BOTH)
        self.SetFocus()
        

class MySplashScreen(wx.SplashScreen):
    """ Create a splash screen widget. """
    def __init__(self, parent=None):
        # This is a recipe to a the screen.
        # Modify the following variables as necessary.
        aBitmap = wx.Image('images\splashscreen.jpg').ConvertToBitmap()
        splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT
        splashDuration=100
        # Call the constructor with the above arguments in exactly the
        # following order.
        wx.SplashScreen.__init__(self, aBitmap, splashStyle, splashDuration, parent)
        self.Bind(wx.EVT_CLOSE, self.OnSplashScreenExit)
        wx.Yield()

    def OnSplashScreenExit(self, evt):
        self.Hide()
        app = wx.PySimpleApp()
        frame = MyFrame(None, -1, '', size=(800,600))
        frame.CenterOnScreen()
        frame.Show()
        app.MainLoop()
        # The program will freeze without this line.
        evt.Skip()  # Make sure the default handler runs too...

class MyApp(wx.App):
    def OnInit(self):
        MySplash = MySplashScreen()
        MySplash.Show()
        return True

app = MyApp(redirect=False)
app.MainLoop()
This article has been dead for over six months. Start a new discussion instead.