wxPython:启动画面SplashScreen介绍

来源:互联网 发布:ghost覆盖 数据恢复 编辑:程序博客网 时间:2024/05/21 09:26

 程序启动时出现一个启动画面,先看代码:

class PaintApp(wx.App):    def OnInit(self):        bmp = wx.Image("P7080079.JPG").ConvertToBitmap()        wx.SplashScreen(bmp,                        wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT,,                        None,                        -1)        wx.Yield()        frame = PaintFrame(None)        frame.Show(True)        self.SetTopWindow(frame)        return True            if __name__ == '__main__':    app = PaintApp()    app.MainLoop()
测试一下,使用一张自己前几天拍的荷花。


知识点:

原型:

wxSplashScreen(const wxBitmap& bitmaplong splashStyleint millisecondswxWindow*parentwxWindowID idconst wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)

splashStyle is a bitlist of some of the following:

  • wxSPLASH_CENTRE_ON_PARENT
  • wxSPLASH_CENTRE_ON_SCREEN
  • wxSPLASH_NO_CENTRE
  • wxSPLASH_TIMEOUT
  • wxSPLASH_NO_TIMEOUT

milliseconds is the timeout in milliseconds.

方法:

  • wxSplashScreen::OnCloseWindow
  • wxSplashScreen::GetSplashStyle
  • wxSplashScreen::GetSplashWindow
  • wxSplashScreen::GetTimeout