本文整理汇总了Python中wx.version函数的典型用法代码示例。如果您正苦于以下问题:Python version函数的具体用法?Python version怎么用?Python version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnInit
def OnInit(self):
print wx.version()
frame = ExplorerFrame(None)
self.SetTopWindow(frame)
frame.Show()
return True
示例2: CreatePopupMenu
def CreatePopupMenu(self):
"""
Overrides method in parent class to provide a Popup Menu
when the user clicks on MyData's system tray (or menubar) icon.
"""
self.menu = wx.Menu()
self.myTardisSyncMenuItem = wx.MenuItem(
self.menu, wx.NewId(), "MyTardis Sync")
if wx.version().startswith("3.0.3.dev"):
self.menu.Append(self.myTardisSyncMenuItem)
else:
self.menu.AppendItem(self.myTardisSyncMenuItem)
self.Bind(wx.EVT_MENU, self.OnMyTardisSync,
self.myTardisSyncMenuItem, self.myTardisSyncMenuItem.GetId())
self.menu.AppendSeparator()
self.myTardisMainWindowMenuItem = wx.MenuItem(
self.menu, wx.NewId(), "MyData Main Window")
if wx.version().startswith("3.0.3.dev"):
self.menu.Append(self.myTardisMainWindowMenuItem)
else:
self.menu.AppendItem(self.myTardisMainWindowMenuItem)
self.Bind(wx.EVT_MENU, self.OnMyDataMainWindow,
self.myTardisMainWindowMenuItem)
self.myTardisSettingsMenuItem = wx.MenuItem(
self.menu, wx.NewId(), "MyData Settings")
if wx.version().startswith("3.0.3.dev"):
self.menu.Append(self.myTardisSettingsMenuItem)
else:
self.menu.AppendItem(self.myTardisSettingsMenuItem)
self.Bind(wx.EVT_MENU, self.OnMyDataSettings,
self.myTardisSettingsMenuItem)
self.menu.AppendSeparator()
self.myTardisHelpMenuItem = wx.MenuItem(
self.menu, wx.NewId(), "MyData Help")
if wx.version().startswith("3.0.3.dev"):
self.menu.Append(self.myTardisHelpMenuItem)
else:
self.menu.AppendItem(self.myTardisHelpMenuItem)
self.Bind(wx.EVT_MENU, self.OnMyDataHelp, self.myTardisHelpMenuItem)
self.menu.AppendSeparator()
self.exitMyDataMenuItem = wx.MenuItem(
self.menu, wx.NewId(), "Exit MyData")
if wx.version().startswith("3.0.3.dev"):
self.menu.Append(self.exitMyDataMenuItem)
else:
self.menu.AppendItem(self.exitMyDataMenuItem)
self.Bind(wx.EVT_MENU, self.OnExit, self.exitMyDataMenuItem)
return self.menu
示例3: __init__
def __init__(self):
wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
title='wxPython example', size=(WIDTH, HEIGHT))
self.browser = None
# Must ignore X11 errors like 'BadWindow' and others by
# installing X11 error handlers. This must be done after
# wx was intialized.
if LINUX:
WindowUtils.InstallX11ErrorHandlers()
global g_count_windows
g_count_windows += 1
self.setup_icon()
self.create_menu()
self.Bind(wx.EVT_CLOSE, self.OnClose)
# Set wx.WANTS_CHARS style for the keyboard to work.
# This style also needs to be set for all parent controls.
self.browser_panel = wx.Panel(self, style=wx.WANTS_CHARS)
self.browser_panel.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.browser_panel.Bind(wx.EVT_SIZE, self.OnSize)
if MAC:
try:
# noinspection PyUnresolvedReferences
from AppKit import NSApp
# Make the content view for the window have a layer.
# This will make all sub-views have layers. This is
# necessary to ensure correct layer ordering of all
# child views and their layers. This fixes Window
# glitchiness during initial loading on Mac (Issue #371).
NSApp.windows()[0].contentView().setWantsLayer_(True)
except ImportError:
print("[wxpython.py] Warning: PyObjC package is missing, "
"cannot fix Issue #371")
print("[wxpython.py] To install PyObjC type: "
"pip install -U pyobjc")
if LINUX:
# On Linux must show before embedding browser, so that handle
# is available (Issue #347).
self.Show()
# In wxPython 3.0 and wxPython 4.0 on Linux handle is
# still not yet available, so must delay embedding browser
# (Issue #349).
if wx.version().startswith("3.") or wx.version().startswith("4."):
wx.CallLater(1000, self.embed_browser)
else:
# This works fine in wxPython 2.8 on Linux
self.embed_browser()
else:
self.embed_browser()
self.Show()
示例4: __populate_versions
def __populate_versions(self, control):
imageType = 'Pillow'
try:
imageVer = Image.PILLOW_VERSION
except AttributeError:
imageType = 'PIL'
imageVer = Image.VERSION
versions = ('Hardware:\n'
'\tProcessor: {}, {} cores\n\n'
'Software:\n'
'\tOS: {}, {}\n'
'\tPython: {}\n'
'\tmatplotlib: {}\n'
'\tNumPy: {}\n'
'\t{}: {}\n'
'\tpySerial: {}\n'
'\twxPython: {}\n'
).format(platform.processor(), multiprocessing.cpu_count(),
platform.platform(), platform.machine(),
platform.python_version(),
matplotlib.__version__,
numpy.version.version,
imageType, imageVer,
serial.VERSION,
wx.version())
control.SetValue(versions)
dc = wx.WindowDC(control)
extent = list(dc.GetMultiLineTextExtent(versions, control.GetFont()))
extent[0] += wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X) * 2
extent[1] += wx.SystemSettings.GetMetric(wx.SYS_HSCROLL_Y) * 2
control.SetMinSize((extent[0], extent[1]))
self.Layout()
示例5: _CreateHtmlContent
def _CreateHtmlContent(self):
"""Create content for this About Dialog."""
try:
self._content_string = open(self._CONTENT_FILENAME).read()
except IOError:
raise AboutBoxException('Cannot open or read about box content')
# Grab SDK version information
sdk_version = '???' # default
sdk_dir = self._preferences[launcher.Preferences.PREF_APPENGINE]
if sdk_dir:
sdk_version_file = os.path.join(sdk_dir, 'VERSION')
try:
sdk_version = '<br>'.join(open(sdk_version_file).readlines())
except IOError:
pass
# By default, wx.html windows have a white background. We'd
# prefer a standard window background color. Although there is
# a wx.html.HtmlWindow.SetBackgroundColour() method, it doesn't
# help us. The best we can do is set the background from within
# the html itself.
bgcolor = '#%02x%02x%02x' % self._background_color[0:3]
# Replace some strings with dynamically determined information.
text = self._content_string
text = text.replace('{background-color}', bgcolor)
text = text.replace('{launcher-version}', '???') # TODO(jrg): add a version
text = text.replace('{python-version}', sys.version.split()[0])
text = text.replace('{wxpython-version}', wx.version())
text = text.replace('{sdk-version}', sdk_version)
self._content_string = text
示例6: check_versions
def check_versions():
print("[wxpython.py] CEF Python {ver}".format(ver=cef.__version__))
print("[wxpython.py] Python {ver} {arch}".format(
ver=platform.python_version(), arch=platform.architecture()[0]))
print("[wxpython.py] wxPython {ver}".format(ver=wx.version()))
# CEF Python version requirement
assert cef.__version__ >= "55.3", "CEF Python v55.3+ required to run this"
示例7: EnvironmentInfo
def EnvironmentInfo():
"""
Returns a string of the systems information.
**Returns:**
* System information string
**Note:**
* from Editra.dev_tool
"""
info = list()
info.append("---- Notes ----")
info.append("Please provide additional information about the crash here")
info.extend(["", "", ""])
info.append("---- System Information ----")
info.append("Operating System: %s" % wx.GetOsDescription())
if sys.platform == 'darwin':
info.append("Mac OSX: %s" % platform.mac_ver()[0])
info.append("Python Version: %s" % sys.version)
info.append("wxPython Version: %s" % wx.version())
info.append("wxPython Info: (%s)" % ", ".join(wx.PlatformInfo))
info.append("Python Encoding: Default = %s File = %s" % \
(sys.getdefaultencoding(), sys.getfilesystemencoding()))
info.append("wxPython Encoding: %s" % wx.GetDefaultPyEncoding())
info.append("System Architecture: %s %s" % (platform.architecture()[0], \
platform.machine()))
info.append("Byte order: %s" % sys.byteorder)
info.append("Frozen: %s" % str(getattr(sys, 'frozen', 'False')))
info.append("---- End System Information ----")
return os.linesep.join(info)
示例8: __init__
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
# There needs to be an "Images" directory with one or more jpegs in it in the
# current working directory for this to work.
self.jpgs = GetJpgList("./Images") # Get all the jpegs in the Images directory.
self.CurrentJpg = 0
self.MaxImageSize = 200
b = wx.Button(self, -1, "Display next")
b.Bind(wx.EVT_BUTTON, self.DisplayNext)
# Starting with an EmptyBitmap, the real one will get put there
# by the call to .DisplayNext().
if 'phoenix' in wx.version():
bmp = wx.Bitmap(self.MaxImageSize, self.MaxImageSize)
else:
bmp = wx.EmptyBitmap(self.MaxImageSize, self.MaxImageSize)
self.Image = wx.StaticBitmap(self, -1, bmp)
self.DisplayNext()
# Using a Sizer to handle the layout: I never use absolute positioning.
box = wx.BoxSizer(wx.VERTICAL)
box.Add(b, 0, wx.CENTER | wx.ALL, 10)
# Adding stretchable space before and after centers the image.
box.Add((1, 1), 1)
box.Add(self.Image, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL | wx.ADJUST_MINSIZE, 10)
box.Add((1, 1), 1)
self.SetSizerAndFit(box)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
示例9: software_stack
def software_stack():
"""
Import all the hard dependencies.
Returns a dict with the version.
"""
# Mandatory
import numpy, scipy
d = dict(
numpy=numpy.version.version,
scipy=scipy.version.version,
)
# Optional but strongly suggested.
try:
import netCDF4, matplotlib
d.update(dict(
netCDF4=netCDF4.getlibversion(),
matplotlib="Version: %s, backend: %s" % (matplotlib.__version__, matplotlib.get_backend()),
))
except ImportError:
pass
# Optional (GUIs).
try:
import wx
d["wx"] = wx.version()
except ImportError:
pass
return d
示例10: CheckForWx
def CheckForWx():
"""Try to import wx module and check its version"""
if 'wx' in sys.modules.keys():
return
minVersion = [2, 8, 10, 1]
try:
try:
import wxversion
except ImportError as e:
raise ImportError(e)
# wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
import wx
version = wx.version().split(' ')[0]
if map(int, version.split('.')) < minVersion:
raise ValueError('Your wxPython version is %s.%s.%s.%s' % tuple(version.split('.')))
except ImportError as e:
print >> sys.stderr, 'ERROR: wxGUI requires wxPython. %s' % str(e)
sys.exit(1)
except (ValueError, wxversion.VersionError) as e:
print >> sys.stderr, 'ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(minVersion) + \
'%s.' % (str(e))
sys.exit(1)
except locale.Error as e:
print >> sys.stderr, "Unable to set locale:", e
os.environ['LC_ALL'] = ''
示例11: __init__
def __init__(self, parent, exception=''):
wx.Dialog.__init__(self, parent, -1, 'Application Error', style=wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP)
# get system information
self.exception = ''
self.exception += exception
self.exception += '\n-------------------------'
self.exception += '\nmMass: %s' % (config.version)
self.exception += '\nPython: %s' % str(platform.python_version_tuple())
self.exception += '\nwxPython: %s' % str(wx.version())
self.exception += '\nNumPy: %s' % str(numpy.version.version)
self.exception += '\n-------------------------'
self.exception += '\nArchitecture: %s' % str(platform.architecture())
self.exception += '\nMachine: %s' % str(platform.machine())
self.exception += '\nPlatform: %s' % str(platform.platform())
self.exception += '\nProcessor: %s' % str(platform.processor())
self.exception += '\nSystem: %s' % str(platform.system())
self.exception += '\nMac: %s' % str(platform.mac_ver())
self.exception += '\nMSW: %s' % str(platform.win32_ver())
self.exception += '\nLinux: %s' % str(platform.dist())
self.exception += '\n-------------------------\n'
self.exception += 'Add your comments:\n'
# make GUI
sizer = self.makeGUI()
# fit layout
self.Layout()
sizer.Fit(self)
self.SetSizer(sizer)
self.SetMinSize(self.GetSize())
self.Centre()
示例12: __init__
def __init__(self, WindowUtils, OS_PLATFORM, WIDTH=1400, HEIGHT=800):
wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
title="wxPython example", size=(WIDTH, HEIGHT))
self.browser = None
self.WindowUtils = WindowUtils
self.OS_PLATFORM = OS_PLATFORM
if OS_PLATFORM == "LINUX":
self.WindowUtils.InstallX11ErrorHandlers()
global g_count_windows
g_count_windows += 1
self.setup_icon()
self.create_menu()
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.browser_panel = wx.Panel(self, style=wx.WANTS_CHARS)
self.browser_panel.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.browser_panel.Bind(wx.EVT_SIZE, self.OnSize)
if OS_PLATFORM == "LINUX":
self.Show()
if wx.version.startswith("3.") or wx.version().startswith("4."):
wx.CallLater(20, self.embed_browser)
else:
self.embed_browser()
else:
self.embed_browser()
self.Show()
示例13: GetEnvironmentInfo
def GetEnvironmentInfo(self):
"""Get the enviromental info / Header of error report
@return: string
"""
system_language = wx.Locale.GetLanguageName(wx.Locale.GetSystemLanguage())
running_language = wx.Locale.GetLanguageName(wx.GetLocale().GetLanguage())
res = wx.Display().GetGeometry()
info = list()
info.append(self.GetProgramName())
info.append(u"Operating System: %s" % wx.GetOsDescription())
if sys.platform == 'darwin':
info.append(u"Mac OSX: %s" % platform.mac_ver()[0])
info.append(u"System Lanauge: %s" % system_language)
info.append(u"Running Lanauge: %s" % running_language)
info.append(u"Screen Resolution: %ix%i" % (res[2], res[3]))
info.append(u"Python Version: %s" % sys.version)
info.append(u"wxPython Version: %s" % wx.version())
info.append(u"wxPython Info: (%s)" % ", ".join(wx.PlatformInfo))
info.append(u"Python Encoding: Default=%s File=%s" % \
(sys.getdefaultencoding(), sys.getfilesystemencoding()))
info.append(u"wxPython Encoding: %s" % wx.GetDefaultPyEncoding())
info.append(u"System Architecture: %s %s" % (platform.architecture()[0], \
platform.machine()))
info.append(u"Frozen: %s" % str(getattr(sys, 'frozen', 'False')))
info.append(u"")
info.append(u"")
return info#os.linesep.join(info)
示例14: layout_all
def layout_all(self,dc=None):
#settingbackgroundcolors
#background = wx.NamedColour(self.background_color)
#if self.GetBackgroundColour() != background:
# self.SetBackgroundColour(background)
#self.Clear()
# print 'refreshing'
if not dc:
dc = wx.ClientDC(self)
if wx.version().startswith('3'):
self.client_size = self.GetClientSizeTuple()#seb An array doesn't make sense as a truth value: array(self.GetClientSizeTuple())
else:
self.client_size = self.GetClientSize()
# set the device context for all titles so they can
# calculate their size
for text_obj in self.all_titles:
text_obj.set_dc(dc)
graph_area = box_object((0,0),self.client_size)
graph_area.inflate(.95) # shrink box slightly
# shrink graph area to make room for titles
graph_area = self.layout_border_text(graph_area)
# layout axis and graph data
graph_area = self.layout_graph(graph_area,dc)
# center titles around graph area.
self.finalize_border_text(graph_area,dc)
self.graph_box = graph_area
# clear the dc for all titles
# ? neccessary ?
for text_obj in self.all_titles:
text_obj.clear_dc()
self.layout_data()
示例15: format_popup
def format_popup(self,pos):
menu = wx.Menu()
menu.Append(505, 'previous zoom', 'previous zoom')
menu.Enable(505, len(self.zoom_hist) and self.zoom_hist_i>0)
menu.Append(500, 'Auto Zoom', 'Auto Zoom')
menu.Append(506, 'next zoom', 'next zoom')
menu.Enable(506, len(self.zoom_hist) and self.zoom_hist_i<len(self.zoom_hist)-1)
menu.Append(507, 'clear zoom history', 'clear zoom history')
menu.Append(501, 'X-Y equal aspect ratio', 'X-Y equal - set aspect ratio to 1')
menu.Append(502, 'X-Y any aspect ratio', 'X-Y equal - set aspect ratio to "normal"')
menu.Append(503, 'make X-Y axes a tight fit', 'fit X-Y axes to a fraction of the grid spacing"')
menu.Append(504, 'freeze X-Y axes bounds', 'freeze X-Y axes grid"')
self.Bind(wx.EVT_MENU, self.on_prev_zoom, id=505)
self.Bind(wx.EVT_MENU, self.on_next_zoom, id=506)
self.Bind(wx.EVT_MENU, self.on_zoom_forget, id=507)
self.Bind(wx.EVT_MENU, self.on_auto_zoom, id=500)
self.Bind(wx.EVT_MENU, self.on_equal_aspect_ratio, id=501)
self.Bind(wx.EVT_MENU, self.on_any_aspect_ratio, id=502)
self.Bind(wx.EVT_MENU, self.on_axis_tight, id=503)
self.Bind(wx.EVT_MENU, self.on_axis_freeze, id=504)
#20090603 (called by default) menu.UpdateUI()
if wx.version().startswith('3'):
self.PopupMenuXY(menu) #20090603 (default mouse cursor pos) ,pos[0],pos[1])
else:
self.PopupMenu(menu)