Sandro Tosi wrote:
import wxversion
wxversion.select('2.8')
from wx import *
wx.__version__
'2.8.7.1'
That solves the problem of multi-wx on a system.
What do you think about adding those 2 line into wx examples?
hmmm - only the examples? or should it be in the wx back-end itself?
Maybe at least a version check?
I'll leave this to the mpl gurus...
Anyway -- certainly the examples
...while I'll concentrate on them
Moreover, I will provide a patch to move from
from wx import *
to
import wx
who hoo! thanks!
AFAIUI, it's not possible to say "2.8+" == "2.8 and all the higher
versions",
I think there is:
wxPython API Documentation — wxPython Phoenix 4.2.1 documentation
you need:
import wxversion
wxversion.ensureMinimal('2.8')
I think that will do it, but I haven't tested much -- I only have one
version installed now. If it does work, I say we definitely ue it in the.
Another option is to put it in the wx back-end in a try block:
wxversion.ensureMinimal('2.4')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/wxPython-unicode-2.8.9.1/lib/python2.5/site-packages/wxversion.py",
line 181, in ensureMinimal
raise AlreadyImportedError("wxversion.ensureMinimal() must be
called before wxPython is imported")
wxversion.AlreadyImportedError: wxversion.ensureMinimal() must be called
before wxPython is imported
which might be the safest, and would catch both pylab use, and people's
home-written apps that need the wxversion call.
yeah, that's what we need: I got 2 version installed (2.6 and 2.8) and
here is the output
In [1]: import wxversion
In [2]: help(wxversion.ensureMinimal)
In [3]: wxversion.ensureMinimal('2.6')
In [4]: import wx
In [5]: wx.__version__
Out[5]: '2.6.3.2'
and
In [2]: import wxversion
In [3]: wxversion.ensureMinimal('2.8')
In [4]: import wx
In [5]: wx.__version__
Out[5]: '2.8.7.1'
So I'm going to use it in the examples. Thanks for spotting it out!
I only hope that 2.8->2.10 (or higher) would not introduce such corner
cases like in 2.6->2.8.
Cheers,
···
On Mon, Mar 9, 2009 at 21:55, Christopher Barker <Chris.Barker@...236...> wrote:
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi