SplashScreen & Ticker

     
import wx
import wx.lib.ticker
  
class Frame(wx.Frame):

def __init__(
  self, parent=None, id=wx.ID_ANY, title='SplashScreen & Ticker',
  pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
  ):
  
  wx.Frame.__init__(self, parent, id, title, pos, size, style)
  self.SetIcon(wx.Icon('wxWidgets.ico', wx.BITMAP_TYPE_ICO))
  
  panel = wx.Panel(self, wx.ID_ANY)
  ticker = wx.lib.ticker.Ticker(panel)
  ticker.SetText('How Cute wx.SplashScreen Is!')
  
  sizer = wx.BoxSizer(wx.VERTICAL)
  sizer.Add(ticker, flag=wx.ALL|wx.EXPAND, border=5)
  panel.SetSizer(sizer)
  


class SplashScreen(wx.SplashScreen):

def __init__(self):
  bitmap = wx.Image('toucan.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap()
  wx.SplashScreen.__init__(self, bitmap,
         wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
         5000, None, -1)
  
  self.Bind(wx.EVT_CLOSE, self.OnClose)
  self.futureCall = wx.FutureCall(2000, self.ShowMainFrame)
  
  
# This method will be called under 2 cases:
# 1. time-limit is up, called automatically
# 2. you left-click on the splash-bitmap
def OnClose(self, event):
  # wx.MessageBox('OnClose Of SplashScreen', 'Prompt')
  # self.Destroy()
  event.Skip()
  self.Hide()
  
  if self.futureCall.IsRunning():
   self.futureCall.Stop()
   self.ShowMainFrame()
  
  
def ShowMainFrame(self):
  frame = Frame()
  frame.Centre()
  frame.Show()
  
  if self.futureCall.IsRunning():
   self.Raise()
  
  
  
def TestFrame():
app = wx.PySimpleApp()

splash = SplashScreen()
splash.Show()

app.MainLoop()

if __name__ == '__main__':
TestFrame()