wx SplashScreen不起作用

时间:2013-07-24 20:17:09

标签: python user-interface wxpython wxwidgets

我使用了wiki中的示例代码,但它对我不起作用,我什么也看不见。我做错了什么?

import wx

app = wx.App()

aBitmap = wx.Image(name = "wxPyWiki.jpg").ConvertToBitmap()
splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT
splashDuration = 1000

splash = wx.adv.SplashScreen(aBitmap, splashStyle,
                                 splashDuration, None)
splash.Show()
wx.Yield()

1 个答案:

答案 0 :(得分:0)

注意SplashScreen在wxpython 2.8.12中不在wx.adv中(我正在使用它)

这有效(用我自己的形象)

import wx

app = wx.App()
aBitmap = wx.Image(name = "zimages/gato.jpg").ConvertToBitmap()
splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT
splashDuration = 1000

splash = wx.SplashScreen(aBitmap, splashStyle,
                                 splashDuration, None)
splash.Show()
app.MainLoop()

唯一的区别是使用wx.Yield vs app.MainLoop 我不确定Yield在wxpython 2.9中的用途,但请注意wx.Yield() has been deprecated