wx versions in Ubuntu - how to force import of version 2.8?

In Ubuntu Jaunty (9.04) is see that both python-wxgtk2.6 and python-
wxgtk2.8 are installed. When I run python and import wx, I am getting
the 2.6 version, as shown below:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx
wx

<module 'wx' from '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-
unicode/wx/__init__.pyc'>

I assume Ubuntu defaults to 2.6 for compatibility with existing
applications. How do I import wx for my application so that version
2.8 is used without forcing the rest of the system to use 2.8?

Thanks,
Tom

qbee42 escribió:

In Ubuntu Jaunty (9.04) is see that both python-wxgtk2.6 and python-
wxgtk2.8 are installed. When I run python and import wx, I am getting
the 2.6 version, as shown below:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx
wx

<module 'wx' from '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-
unicode/wx/__init__.pyc'>

I assume Ubuntu defaults to 2.6 for compatibility with existing
applications. How do I import wx for my application so that version
2.8 is used without forcing the rest of the system to use 2.8?

Thanks,
Tom

You should use the wxversion module (python-wxgtk2.8 depends on it, so when you install wxPython, it gets installed too).

Here is a copy-and-paste from the first part of the docs:

If you have more than one version of wxPython installed this module
     allows your application to choose which version of wxPython will be
     imported when it does 'import wx'. The main function of this module
     is `select` and you use it like this::
         import wxversion
         wxversion.select('2.4')
         import wx
     Or additional build options can also be selected, although they will
     not be required if they are not installed, like this::
         import wxversion
         wxversion.select('2.5.3-unicode')
         import wx
     Or you can require an exact match on the build options like this::
         import wxversion
         wxversion.select('2.5.3-unicode', optionsRequired=True)
         import wx
     Finally you can also specify a collection of versions that are allowed
     by your application, like this::
         import wxversion
         wxversion.select(['2.5.4', '2.5.5', '2.6'])
         import wx

Regards,
Marcelo

···

--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA

E-Mail: marcelo.fidel.fernandez@gmail.com
Jabber ID: fernandezm22@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog: http://blog.marcelofernandez.info

Thanks! This is exactly what I needed. I used the wxversion.select
('2.8') in the main application, and all of the other modules pick up
the correct version automatically.

Thanks again,
Tom

···

On Jun 3, 12:56 pm, Marcelo Fernández <marcelo.fidel.fernan...@gmail.com> wrote:

qbee42 escribió:

> In Ubuntu Jaunty (9.04) is see that both python-wxgtk2.6 and python-
> wxgtk2.8 are installed. When I run python and import wx, I am getting
> the 2.6 version, as shown below:

> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import wx
>>>> wx
> <module 'wx' from '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-
> unicode/wx/__init__.pyc'>

> I assume Ubuntu defaults to 2.6 for compatibility with existing
> applications. How do I import wx for my application so that version
> 2.8 is used without forcing the rest of the system to use 2.8?

> Thanks,
> Tom

You should use the wxversion module (python-wxgtk2.8 depends on it, so
when you install wxPython, it gets installed too).

Here is a copy-and-paste from the first part of the docs:

If you have more than one version of wxPython installed this module
allows your application to choose which version of wxPython will be
imported when it does 'import wx'. The main function of this module
is `select` and you use it like this::
import wxversion
wxversion.select('2.4')
import wx
Or additional build options can also be selected, although they will
not be required if they are not installed, like this::
import wxversion
wxversion.select('2.5.3-unicode')
import wx
Or you can require an exact match on the build options like this::
import wxversion
wxversion.select('2.5.3-unicode', optionsRequired=True)
import wx
Finally you can also specify a collection of versions that are allowed
by your application, like this::
import wxversion
wxversion.select(['2.5.4', '2.5.5', '2.6'])
import wx

Regards,
Marcelo
--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA

E-Mail: marcelo.fidel.fernan...@gmail.com
Jabber ID: fernandez...@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog:http://blog.marcelofernandez.info