wxPython:启动画面SplashScreen介绍

本文介绍如何使用wxPython创建应用程序启动画面。通过示例代码展示了如何加载图片作为启动画面,并设置了显示时间。此外还介绍了wxSplashScreen的方法和参数。

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

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

转载于:https://www.cnblogs.com/dyx1024/archive/2012/07/17/2596572.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值