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

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航