初次用wxPython,文档又少,只好一边看代码,一边摸索着前进了。
下面是我的代码:
[myphp]
import wx
import os
def opj(path):
"""Convert paths to the platform-specific separator"""
return apply(os.path.join, tuple(path.split('/')))
class MySplashScreen(wx.SplashScreen):
def __init__(self):
bmp = wx.Image(opj("000009.png")).ConvertToBitmap()
wx.SplashScreen.__init__(self, bmp,
wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT,
4000, None, -1,
style = wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP)
class MyApp(wx.App):
def OnInit(self):
"""
Create and show the splash screen. It will then create and show
the main frame when it is time to do so.
"""
#import locale
#self.locale = wx.Locale(wx.LANGUAGE_FRENCH)
#locale.setlocale(locale.LC_ALL, 'fr')
wx.InitAllImageHandlers()
splash = MySplashScreen()
splash.Show()
return True
if __name__ == "__main__" :
a = MyApp(0)
a.MainLoop()
[/myphp]
代码很简单,但是解释了python和wxPython的简单强大的功能。