当前位置:Linux教程 - Linux综合 - Python+wxPython的展示窗体的代码编写

Python+wxPython的展示窗体的代码编写

  初次用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的简单强大的功能。

(出处:http://www.sheup.com)