+def selectNewest(minVersion):
+ """
+ Selects a version of wxPython that has a version number greater
+ than or equal to the version given. If a matching version is not
+ found then instead of raising an exception like select() does this
+ function will inform the user of that fact with a message dialog,
+ open the system's default web browser to the wxPython download
+ page, and then will exit the application.
+ """
+ assert type(minVersion) == str
+
+ # ensure that wxPython hasn't been imported yet.
+ if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
+ raise VersionError("wxversion.select() must be called before wxPython is imported")
+
+ bestMatch = None
+ installed = _find_installed(True)
+ minv = _wxPackageInfo(minVersion)
+
+ if installed:
+ # The list is in reverse sorted order, so if the first one is
+ # big enough then choose it
+ if installed[0] >= minv:
+ bestMatch = installed[0]
+
+ if bestMatch is None:
+ import wx, webbrowser
+ versions = "\n".join([" "+ver for ver in getInstalled()])
+ app = wx.PySimpleApp()
+ wx.MessageBox("This application requires a version of wxPython "
+ "greater than or equal to %s but a matching version "
+ "was not found.\n\n"
+ "You currently have these version(s) installed:\n%s"
+ % (minVersion, versions),
+ "wxPython Upgrade Needed", style=wx.OK)
+ app.MainLoop()
+ webbrowser.open("http://sourceforge.net/project/showfiles.php?group_id=10718")
+ sys.exit()
+
+ sys.path.insert(0, bestMatch.pathname)
+ _selected = bestMatch
+
+
+#----------------------------------------------------------------------
+