def test_utilsVersionInfo(self): vi = wx.GetLibraryVersionInfo() assert isinstance(vi, wx.VersionInfo) vi.ToString() vi.Major vi.Minor vi.Micro vi.Copyright vi.Description vi.Name vi.VersionString
def _createInterface(self): sTitle = 'AboutBoxDlg (v1.0.0)' sVersion = wx.version() pos = sVersion.find(' wxWidgets') if pos != -1: sVersion = sVersion[:pos] sMsg = 'Made with wxPython ' + sVersion + '\nBased on ' + wx.GetLibraryVersionInfo().VersionString szrMain = wx.BoxSizer(wx.VERTICAL) szrTop = wx.BoxSizer(wx.HORIZONTAL) bmpCtrl = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap('../../common/wxWidgets.png', wx.BITMAP_TYPE_PNG)) szrTop.Add(bmpCtrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szrRight = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, wx.ID_STATIC, sTitle) fntTitle = label.GetFont() fntTitle.MakeLarger() fntTitle.MakeBold() label.SetFont(fntTitle) szrRight.Add(label, 0, wx.ALL|wx.ALIGN_CENTER, 5) label = wx.StaticText(self, wx.ID_STATIC, 'Copyright (c) X.P. 2018') szrRight.Add(label, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER, 5) label = wx.StaticText(self, wx.ID_STATIC, 'wxWidgets Application') szrRight.Add(label, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.ALIGN_CENTER, 5) label = wx.StaticText(self, wx.ID_STATIC, sMsg, style=wx.ST_NO_AUTORESIZE|wx.ALIGN_CENTER) szrRight.Add(label, 0, wx.ALL|wx.EXPAND, 5) szrTop.Add(szrRight, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szrMain.Add(szrTop, 0, wx.ALL, 5) btnSzr = self.CreateSeparatedButtonSizer(wx.CLOSE) szrMain.Add(btnSzr, 0, wx.ALL|wx.EXPAND, 5) self.SetSizer(szrMain) szrMain.SetSizeHints(self)
def 程序_系统是否已激活(): "返回True或False,不太确定是不是这个命令,获取更多电脑描述信息参考:https://wxpython.org/Phoenix/docs/html/wx.VersionInfo.html#wx-versioninfo" return wx.GetLibraryVersionInfo().HasCopyright()
import os import re import wx import wx.grid from . import dialog_base if hasattr(wx, "GetLibraryVersionInfo"): WX_VERSION = wx.GetLibraryVersionInfo() # type: wx.VersionInfo WX_VERSION = (WX_VERSION.Major, WX_VERSION.Minor, WX_VERSION.Micro) else: # old kicad used this (exact version doesnt matter) WX_VERSION = (3, 0, 2) def pop_error(msg): wx.MessageBox(msg, 'Error', wx.OK | wx.ICON_ERROR) def get_btn_bitmap(bitmap): path = os.path.join(os.path.dirname(__file__), "bitmaps", bitmap) png = wx.Bitmap(path, wx.BITMAP_TYPE_PNG) if WX_VERSION >= (3, 1, 6): return wx.BitmapBundle(png) else: return png class SettingsDialog(dialog_base.SettingsDialogBase):