文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>SplashScreen & Ticker

SplashScreen & Ticker

时间:2007-04-19  来源:wxPhoenix

    
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()
相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载