程序启动时出现一个启动画面,先看代码:
class PaintApp(wx.App): def OnInit(self): bmp = wx.Image("P7080079.JPG").ConvertToBitmap() wx.SplashScreen(bmp, wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT, 3000, 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& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long 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