歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> Python+wxPython的展示窗體的代碼編寫

Python+wxPython的展示窗體的代碼編寫

日期:2017/2/27 14:21:55   编辑:更多Linux
  初次用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的簡單強大的功能。




Copyright © Linux教程網 All Rights Reserved