本文整理汇总了Python中wxversion.select函数的典型用法代码示例。如果您正苦于以下问题:Python select函数的具体用法?Python select怎么用?Python select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
install.run(self)
import sys
# check about wxwidgets
try:
import wxversion
wxversion.select("3.0")
except:
with open("install-wxpython.sh", "w") as shell_script:
shell_script.write(
"""#!/bin/sh
echo 'Prerrequisites'
apt-get --yes --force-yes install libgconf2-dev libgtk2.0-dev libgtk-3-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgconfmm-2.6-dev libwebkitgtk-dev python-gtk2
mkdir -p external
cd external
echo "Downloading wxPython 3.0.2.0"
wget http://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2
echo "Done"
echo 'Uncompressing ...'
tar -xjvf wxPython-src-3.0.2.0.tar.bz2
echo 'Patching ...'
cd wxPython-src-3.0.2.0
cd wxPython
sed -i -e 's/PyErr_Format(PyExc_RuntimeError, mesg)/PyErr_Format(PyExc_RuntimeError, "%s\", mesg)/g' src/gtk/*.cpp contrib/gizmos/gtk/*.cpp
python ./build-wxpython.py --build_dir=../bld --install
ldconfig
cd ../../..
rm -rf external
"""
)
os.system("sh ./install-wxpython.sh")
开发者ID:melviso,项目名称:beatle,代码行数:33,代码来源:setup.py
示例2: CheckForWx
def CheckForWx(forceVersion=os.getenv('GRASS_WXVERSION', None)):
"""Try to import wx module and check its version
:param forceVersion: force wxPython version, eg. '2.8'
"""
if 'wx' in sys.modules.keys():
return
minVersion = [2, 8, 10, 1]
try:
try:
import wxversion
except ImportError as e:
raise ImportError(e)
if forceVersion:
wxversion.select(forceVersion)
wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
import wx
version = wx.__version__
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'] = ''
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:35,代码来源:globalvar.py
示例3: setup_wx
def setup_wx():
# Allow the dynamic selection of wxPython via an environment variable, when devs
# who have multiple versions of the module installed want to pick between them.
# This variable does not have to be set of course, and through normal usage will
# probably not be, but this can make things a little easier when upgrading to a
# new version of wx.
logger = logging.getLogger(__name__)
WX_ENV_VAR = "SASVIEW_WX_VERSION"
if WX_ENV_VAR in os.environ:
logger.info("You have set the %s environment variable to %s.",
WX_ENV_VAR, os.environ[WX_ENV_VAR])
import wxversion
if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):
logger.info("Version %s of wxPython is installed, so using that version.",
os.environ[WX_ENV_VAR])
wxversion.select(os.environ[WX_ENV_VAR])
else:
logger.error("Version %s of wxPython is not installed, so using default version.",
os.environ[WX_ENV_VAR])
else:
logger.info("You have not set the %s environment variable, so using default version of wxPython.",
WX_ENV_VAR)
import wx
try:
logger.info("Wx version: %s", wx.__version__)
except AttributeError:
logger.error("Wx version: error reading version")
from . import wxcruft
wxcruft.call_later_fix()
开发者ID:rprospero,项目名称:sasview,代码行数:32,代码来源:sasview.py
示例4: setWXVersion
def setWXVersion():
import wxversion
if (FORCEWXVERSION):
vforced = '2.8'
wxversion.select(vforced)
else:
wxversion.select(['3.0', '2.8'])
开发者ID:tsartsaris,项目名称:Debreate,代码行数:7,代码来源:common.py
示例5: run
def run(self):
# Note(Kevin): On Python 2, Bajoo should uses the stable 'Classic'
# version. This version must be installed manually by the user
# (usually the package manager of the distribution).
# On python 3, Bajoo uses the 'Phoenix' version of wxPython.
# At this time, the Phoenix version is not stable yet, and only daily
# snapshots are available.
# About wxVersion:
# Some systems allowed several version of wxPython to be installed
# wxVersion allows to pick a version.
# If wxVersion is not available, either wxPython is not installed,
# either the system only allows only one version of wxPython.
if not self.force and sys.version_info[0] is 2:
try:
import wxversion
try:
wxversion.select(['3.0', '2.9', '2.8'])
except wxversion.VersionError:
pass
except ImportError:
pass
try:
import wx # noqa
except ImportError:
print("""\
Bajoo depends on the library wxPython. This library is not available in the
Python Package Index (pypi), and so can't be automatically installed.
On Linux, you can install it from your distribution's package repositories.
On Windows, you can download it from http://wxpython.org/download.php""")
raise Exception('wxPython not found.')
InstallCommand.run(self)
开发者ID:Bajoo,项目名称:client-pc,代码行数:34,代码来源:setup.py
示例6: _OnStart
def _OnStart(self):
if not getattr(sys, 'frozen', False):
import wxversion
wxversion.select("3.0")
from photofilmstrip.gui.PhotoFilmStripApp import PhotoFilmStripApp
app = PhotoFilmStripApp(0)
app.MainLoop()
开发者ID:PhotoFilmStrip,项目名称:PFS,代码行数:8,代码来源:GUI.py
示例7: ensure
def ensure(recommended, minimal):
"""Ensures the minimal version of wxPython is installed.
- minimal: as string (eg. '2.6')"""
#wxversion
try:
import wxversion
if wxversion.checkInstalled(recommended):
wxversion.select(recommended)
else:
wxversion.ensureMinimal(minimal)
import wx
return wx
except ImportError:
sys.stdout.write(_t('Warning: python-wxversion is not installed.\n'))
#wxversion failed, import wx anyway
params = {'recommended': recommended, 'minimal': minimal}
try:
import wx
except ImportError:
message = _t('Error: wxPython %(recommended)s' \
' (or at least %(minimal)s) can not' \
' be found, but is required.'
) % params +\
'\n\n' + _t('Please (re)install it.')
sys.stderr.write(message)
if sys.platform.startswith('linux') and \
os.path.exists('/usr/bin/zenity'):
call('''zenity --error --text="%s"\n\n''' % message + \
_t("This application needs 'python-wxversion' " \
"and 'python-wxgtk%(recommended)s' " \
"(or at least 'python-wxgtk%(minimal)s')."
) % params, shell=True)
sys.exit()
#wxversion failed but wx is available, check version again
params['version'] = wx.VERSION_STRING
if wx.VERSION_STRING < minimal:
class MyApp(wx.App):
def OnInit(self):
result = wx.MessageBox(
_t("This application is known to be compatible" \
" with\nwxPython version(s) %(recommended)s" \
" (or at least %(minimal)s),\nbut you have " \
"%(version)s installed."
) % params + "\n\n" +\
_t("Please upgrade your wxPython."),
_t("wxPython Version Error"),
style=wx.ICON_ERROR)
return False
app = MyApp()
app.MainLoop()
sys.exit()
#wxversion failed, but wx is the right version anyway
return wx
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:57,代码来源:wxcheck.py
示例8: run_gui
def run_gui(filename):
if not appconfig.is_frozen():
try:
import wxversion
try:
wxversion.select('2.8')
except wxversion.AlreadyImportedError:
pass
except ImportError, err:
print 'No wxversion.... (%s)' % str(err)
开发者ID:KarolBedkowski,项目名称:photomagic,代码行数:10,代码来源:main.py
示例9: select_version
def select_version():
# This function is no longer called
try:
import wxversion
wxversion.select(["3.0", "2.9", "2.8", "2.6", "2.5", "2.4"])
except ImportError as e:
version = __get_version()
# Check that the version is correct
if version < (2, 4) or version > (4, 0):
raise RuntimeError("""This version of Gamera requires wxPython 2.4.x, 2.6.x, 2.8.x, 2.9.x, 3.0.x or 4.0.x.
However, it seems that you have wxPython %s installed.""" % ".".join([str(x) for x in version]))
开发者ID:hsnr-gamera,项目名称:gamera,代码行数:11,代码来源:compat_wx.py
示例10: _check_wx
def _check_wx():
try:
import wxversion
except ImportError as exc:
raise ImportError('{exc}; is wxPython installed?'.format(exc=exc))
for ver in ['2.8-unicode', '3.0']:
try:
wxversion.select(ver, optionsRequired=True)
except wxversion.VersionError:
continue
else:
break
else:
raise ImportError('wxPython 3.0 or 2.8 in Unicode mode is required')
开发者ID:jwilk,项目名称:djvusmooth,代码行数:14,代码来源:dependencies.py
示例11: resolve_wxversion
def resolve_wxversion():
patt = "%d\.%d[0-9\-\.A-Za-z]*-unicode"
patts = "-unicode"
versions = wxversion.getInstalled()
if verbose:
print 'wxPython Installed :',versions
# need to select the more recent one with 'unicode'
vSelected = None
vSelectedMsg = ''
for eachVersion in versions:
for min in range(WXVERSION_MINOR1,WXVERSION_MINOR2+1):
m = re.search( patt % (WXVERSION_MAJOR,min), eachVersion)
if m:
if min == WXVERSION_MINOR2:
vSelectedMsg = ''
else:
vSelectedMsg = ' (deprecated version - think to update)'
vSelected = eachVersion
break
if m:
break
if vSelected:
print 'wxPython Selected :',vSelected,vSelectedMsg
wxversion.select(vSelected)
return
# no compatible version :-( : try to select any release
bUnicode = False
for eachVersion in versions:
m = re.search(patts, eachVersion)
if m:
print 'wxPython Selected :',eachVersion
wxversion.select(eachVersion)
bUnicode = True
break
if not bUnicode:
# only ansi release :-( => use US lang
setLang('us')
import sys, wx, webbrowser
app = wx.PySimpleApp()
wx.MessageBox(message('wxversion_msg') % (WXVERSION_MAJOR,WXVERSION_MINOR2), message('wxversion_title'))
app.MainLoop()
webbrowser.open("http://wxpython.org/")
sys.exit()
开发者ID:amremam2004,项目名称:itrade,代码行数:49,代码来源:itrade_wxversion.py
示例12: plot_recon
def plot_recon(
loc,
actual,
recon,
thetitle="Actual vs reconstruction",
showlegend=True):
if not WXVER_SET:
import wxversion
wxversion.select('2.8')
import wx
wxverset = True
figure()
plot(actual, 'r-')
plot(recon, 'b--')
title(thetitle)
if showlegend:
legend(['actual','reconstructed'],'lower right')
xlabel('Time Tick')
ylabel('Value')
savefig(loc,format='png')
开发者ID:cmiller8,项目名称:rainmon,代码行数:21,代码来源:analysis.py
示例13: __init__
def __init__(self,argv=None,user_ns=None,user_global_ns=None,
debug=1,shell_class=MTInteractiveShell):
self.IP = make_IPython(argv,user_ns=user_ns,
user_global_ns=user_global_ns,
debug=debug,
shell_class=shell_class,
on_kill=[self.wxexit])
wantedwxversion=self.IP.rc.wxversion
if wantedwxversion!="0":
try:
import wxversion
except ImportError:
error('The wxversion module is needed for WX version selection')
else:
try:
wxversion.select(wantedwxversion)
except:
self.IP.InteractiveTB()
error('Requested wxPython version %s could not be loaded' %
wantedwxversion)
import wx
threading.Thread.__init__(self)
self.wx = wx
self.wx_mainloop = hijack_wx()
# Allows us to use both Tk and GTK.
self.tk = get_tk()
# HACK: slot for banner in self; it will be passed to the mainloop
# method only and .run() needs it. The actual value will be set by
# .mainloop().
self._banner = None
self.app = None
开发者ID:CVL-dev,项目名称:StructuralBiology,代码行数:38,代码来源:Shell.py
示例14: run
def run():
"""
A wrapper around main(), which handles profiling if requested.
"""
import polymer.options
opts = polymer.options.handle_options()[0]
if opts.wxversion is not None:
import wxversion
if opts.wxversion == 'help':
for x in wxversion.getInstalled():
print "Installed:", x
import sys
sys.exit()
else:
wxversion.select( opts.wxversion )
if opts.profile:
import profile
profile.run( 'main()', opts.profile )
import pstats
prof = pstats.Stats( opts.profile )
prof.sort_stats( 'cumulative', 'calls' ).print_stats( 50 )
else:
main()
return opts.debug
开发者ID:dwd,项目名称:Polymer,代码行数:24,代码来源:polymer.py
示例15:
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# EPlatform is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EPlatform. If not, see <http://www.gnu.org/licenses/>.
import wxversion
wxversion.select('2.8')
import glob, os, time
import time
from random import shuffle
import wx
import wx.lib.buttons as bt
from pymouse import PyMouse
import Tkinter
import numpy as np
import subprocess as sp
import shlex
import pygame
from pygame import mixer
开发者ID:bjura,项目名称:EPlatform,代码行数:31,代码来源:EPlatform.py
示例16: Commandlineparser
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pyspread')
except AttributeError:
# Probably not on Windows
pass
# Patch for using with PyScripter thanks to Colin J. Williams
# If wx exists in sys,modules, we dont need to import wx version.
# wx is already imported if the PyScripter wx engine is used.
try:
sys.modules['wx']
except KeyError:
# Select wx version 3.0 if possible
try:
import wxversion
wxversion.select(['3.0', '2.8', '2.9'])
except ImportError:
pass
from src.gui._events import post_command_event, GridActionEventMixin
DEBUG = False
class Commandlineparser(object):
"""
Command line handling
Methods:
--------
开发者ID:manns,项目名称:pyspread,代码行数:31,代码来源:pyspread.py
示例17: do_review
#!/usr/bin/env python
"""review.py
Alberto Gomez-Casado (c) 2010 University of Twente
"""
from libhooke import WX_GOOD
import wxversion
wxversion.select(WX_GOOD)
from wx import PostEvent
import numpy as np
import shutil
import libinput as linp
import copy
import os.path
import warnings
warnings.simplefilter("ignore", np.RankWarning)
class reviewCommands:
def do_review(self, args):
"""
REVIEW
(review.py)
Presents curves (in current playlist) in groups of ten. User can indicate which curves will be selected to be saved in a separate directory for further analysis.
By default curves are presented separated -30 nm in x and -100 pN in y.
Curve number one of each set is the one showing the approach.
------------
开发者ID:Alwnikrotikz,项目名称:hooke,代码行数:31,代码来源:review.py
示例18: hasattr
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
if not hasattr(sys, "frozen"):
try:
import wxversion
except ImportError:
pass
else:
try:
wxversion.select(["2.8"])
except wxversion.VersionError, e:
# if a new interpreter is started with sys.executable on
# Mac, sys.frozen may not be set, so we allow/ignore
# this error
print(repr(e))
import wx
def call_after(function):
import wx
wx.CallAfter(function)
def call_later(ms, function):
import wx
wx.CallLater(ms, function)
def show_error(message):
import wx
开发者ID:F1relight,项目名称:fs-uae-debian,代码行数:31,代码来源:__init__.py
示例19: TestMainStatusbar
#!/usr/bin/env python
from ...bibiparrot.Constants.constants import __required_wx_version__
import unittest
import logging
import wxversion
wxversion.select(__required_wx_version__)
import wx
import wx.tools.img2py
from ...bibiparrot.UIElements.MainFrame import MainFrame
from ...bibiparrot.UIElements.MainMenu import MainMenu
from ...bibiparrot.UIElements.MainToolbar import MainToolbar
from ...bibiparrot.UIElements.Editor import Editor
from ...bibiparrot.UIElements.MainTabs import MainTabs
from ...bibiparrot.UIElements.MainStatusbar import MainStatusbar
from ...bibiparrot.Configurations.Configuration import log
class TestMainStatusbar(unittest.TestCase):
def setUp(self):
# fimg = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389875652_format-text-strikethrough.png"
# fpy = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389875652_format-text-strikethrough.png.py"
# fimg = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389894439_format-text-strikethrough.png"
# fpy = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389894439_format-text-strikethrough.png.py"
# wx.tools.img2py.img2py(fimg, fpy)
self.app = wx.App(False)
mainframe = MainFrame(None)
开发者ID:bibiparrot,项目名称:bibiparrot,代码行数:31,代码来源:TestMainStatusbar.py
示例20: create
#Boa:Frame:Frame1
""" Frame containing all controls available on the Palette. """
import wxversion
wxversion.select('2.5')
import wx
from wx.lib.anchors import LayoutAnchors
import wx.grid
import wx.lib.buttons
import wx.html
import wx.gizmos
import Everything_img
def create(parent):
return Frame1(parent)
[wxID_FRAME1, wxID_FRAME1BITMAPBUTTON1, wxID_FRAME1BUTTON1,
wxID_FRAME1CHECKBOX1, wxID_FRAME1CHECKLISTBOX1, wxID_FRAME1CHOICE1,
wxID_FRAME1COMBOBOX1, wxID_FRAME1CONTEXTHELPBUTTON1,
wxID_FRAME1DYNAMICSASHWINDOW1, wxID_FRAME1EDITABLELISTBOX1,
wxID_FRAME1GAUGE1, wxID_FRAME1GENBITMAPBUTTON1,
wxID_FRAME1GENBITMAPTEXTTOGGLEBUTTON1, wxID_FRAME1GENBITMAPTOGGLEBUTTON1,
wxID_FRAME1GENBUTTON1, wxID_FRAME1GENTOGGLEBUTTON1, wxID_FRAME1GRID1,
wxID_FRAME1HTMLWINDOW1, wxID_FRAME1LEDNUMBERCTRL1, wxID_FRAME1LISTBOX1,
wxID_FRAME1LISTCTRL1, wxID_FRAME1NOTEBOOK1, wxID_FRAME1PANEL1,
wxID_FRAME1PANEL2, wxID_FRAME1PANEL3, wxID_FRAME1PANEL4, wxID_FRAME1PANEL5,
wxID_FRAME1PANEL6, wxID_FRAME1RADIOBOX1, wxID_FRAME1RADIOBUTTON1,
wxID_FRAME1SASHLAYOUTWINDOW1, wxID_FRAME1SASHWINDOW1, wxID_FRAME1SCROLLBAR1,
开发者ID:Konstantin-Klein,项目名称:wxPython-In-Action,代码行数:31,代码来源:Everything.py
注:本文中的wxversion.select函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论