wxPython:启动画面SplashScreen介绍

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

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()
测试一下,使用一张自己前几天拍的荷花。

wxPython:启动画面SplashScreen介绍_第1张图片

知识点:

原型:

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


你可能感兴趣的:(测试,Class,border,wxPython)