Hi Kingsley,
This post is regarding communication between Python and wxWidgets.
After much analysis, I've decided to use Python 3.1 and wxWidgets
2.8.10 for development of our appln. Due to the unavailability of
wxPython for Python 3.1, we are stuck up with making wxWidgets work
with Python 3.1.
It will be of great help for me, if am properly directed on how to
bind wxWidgets with Python.
Great, thanks! We can certainly help you to get started, but since no
one here has successfully built wxPython for Python 3 yet, you may run
into unexpected issues and it's hard to say how easy or difficult this
task will turn out to be.
To get started, I'd recommend you get the wxWidgets and wxPython code
from the WX_2_8_BRANCH in SVN via the instructions here:
http://wxpython.org/download.php#svnaccess
I'd recommend checking out wxPython inside of wxWidgets, so that the
wxPython tree lives in WX_2_8_BRANCH/wxPython. (Replace WX_2_8_BRANCH
with whatever folder name you used to check out wxWidgets.)
Then start by following the build instructions for the C++ portion of
the toolkit here: Phoenix/README.rst at master · wxWidgets/Phoenix · GitHub On Windows, make sure
you're using the same MSVC version used to build Python 3.
Once you get to the point of building wxPython bindings, you'll need
to make some changes to get things working with Python 3.1.
The task can basically be divided up into two parts:
1) Getting SWIG to generate Python 3 bindings for the C++ wrappers.
The first thing you'll need to do is get a SWIG that supports Python
3, meaning you probably want the latest release. Add -3 to the flags
passed to SWIG in the wxPython/setup.py build script if sys.version[0]
== '3'. You will also need to apply Robin's SWIG customizations to the
latest release, which can be found as a patch in the wxPython tree at
wxPython/SWIG/swig-1.3.29.patch. This may be a trivial task or it may
not; it's hard to know if the patch will apply cleanly to the latest
SWIG since it's been a long time, but if not, further customizations
may need to be made.
I'd also recommend that in wxPython/config.py, near the end, you add a
block like:
if sys.version[0] == '3':
GENDIR = os.path.join('py3', GENDIR)
PKGDIR = os.path.join('py3', PKGDIR)
so that you don't overwrite the Python 2 bindings and cause a ton of
svn conflicts in your files.
Once you have a properly built and running patched SWIG build, you
*should* be able to run setup.py as directed in the BUILD.html
instructions. Let us know if that works for you.
2) Get the Python code in the wxPython/wx/lib dir ready for Python 3.
This is probably mostly a matter of running the Python script 2to3 on
the Python scripts in wxPython/wx/lib, and sending patches for
whatever issues it raises. The tricky part here is that we'd probably
like to keep Python 2.4+ support too, so some of the changes 2to3
makes will probably need to be put in version checks rather than just
applying the change 2to3 did.
We would greatly appreciate it if you could submit patches for changes
you needed to make as you go along, so that everyone can benefit from
your work and so that we could get to the point of actively
maintaining Py 3 bindings.
Thanks,
Kevin
···
On Nov 19, 2009, at 4:02 AM, Kingsley Reuben wrote:
I made the same post in wxWidgets forums. Am directed here.
regards,
Kingsley Reuben
>