wxPython:启动画面SplashScreen介绍
最后更新于:2022-04-01 19:41:41
程序启动时出现一个启动画面,先看代码:
~~~
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()
~~~
测试一下,使用一张自己前几天拍的荷花。
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-08_5757936138447.png)
知识点:
原型:
wxSplashScreen(const [wxBitmap](http://www.cnblogs.com/dyx1024/admin/)& bitmap, long splashStyle, int milliseconds, [wxWindow](http://www.cnblogs.com/dyx1024/admin/)*parent, wxWindowID id, const [wxPoint](http://www.cnblogs.com/dyx1024/admin/)& pos = wxDefaultPosition, const [wxSize](http://www.cnblogs.com/dyx1024/admin/)& 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
';