wxPython users,
Let me start by thanking Robin Dunn for this terrific project! I'm a
long time lurker in wxWindows world, but never bothered actually using
it. Even though 90%+ of my work is in C++, I hate writing GUIs in C++
given most GUIs use bizarre designs (but mostly because I hate writing
GUIs ;-). Robin has certainly chipped away a large chunk of my now
crumbling self resolve to stay far away from writing GUIs.
I'm currently using Python to prototype some new x-ray optics modeling
tools, and wxPython looks like my way out of Tkinter. I also love the
fact that I can simply translate all my existing VTK** scripts from
Tcl to Python.
** Visualization Toolkit http://www.kitware.com/vtk.html
The question that I have is the following -- is there an established
mechanism for writing an C++ extension that depends on and uses types,
eg., wxWindow or wxDC, from wxPython extension?
Note that these extensions are not necessarily SWIG'd, and in fact,
probably will never be.
If I were to move to Python/wxPython in the future, I'll have to deal
with the issue of plotting/charting/etc, and there is nothing even
remotely satisfactory out there for my needs. The ones that are usually
talked about all have significant issues, but I'm hoping that'll change
over time. BLT provides some of the features, but back to Tkinter for
that. I have lots of code using PLPlot, and it already has Python
bindings, and so I wrote up a simple driver, based on code by Frank
Huebner, and now it works very well with wxWindows/C++. The driver
needs the address of the DC it needs to write into, and the problem
I'm running into is how to pass the address to the extension module.
I also have an wxWindows driver for Gist (the graphics package of
Yorick, and also has python bindings), and have similar problems there.
The current hack I'm using is disgusting -- I'm basically extracting the
string representation of the pointer value and passing that to the driver
which re-creates the pointer and casts it to the correct type. Something
like the following:
def plplot_set_wxdc(pl, dc):
import re
pat = re.compile(r'[^_]*_([0-9a-z]*)_.*')
dc_address = pat.sub('0x\\1', dc.this)
# Now pass the DC address via undocumented hack.
pl.plsfnam(dc_address)
or, perhaps:
import pl
# Other things.
pl.plP_esc(pl.PLESC_SET_WXDC, dc)
Help, guidance, etc more than welcome.
Regards,
Mumit
···
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users