初次用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_SCREENwx.SPLASH_TIMEOUT,
4000, None, -1,
style = wx.SIMPLE_BORDERwx.FRAME_NO_TASKBARwx.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的簡單強大的功能。