My ubuntu 9.04 had wx python version 2.6 by default and I installed version 2.8 for one of my lab work. But I wasn't aware of the fact before that 9.04 runs wx 2.6 by default. Initially, my project did not work due to unknown methods associated with the wx python objects I used. I had to then google to find out which version has these methods and which one lacks. I finally figured out by few trial and errors that python (2.5) on my system chose wxpython 2.6 by default. Fortunately, wx now offers a new package called wxversion which you can use to select the version of wxpython you wish to run if you have multiple versions of wxpython installed.
import wxversion
wxversion.select("2.8")
import wx #imports wxpython 2.8
If the requested version is not found, it selects the default version (2.6 in this case). You can find more information regarding this in wxversion.py file included in your python distribution. ( e.g. /usr/lib/python2.5/site-packages/wxversion.py or /usr/lib/python2.6/dist-packages/wxversion.py).
You can also dynamically check the version of wxpython you have imported using wx constants.
>>> print wx.VERSION_STRING #returns version as a string
2.8.10.1
>>> print wx.VERSION #returns version values in a tuple
(2, 8, 10, 1, '')
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment