Re: [cython-users] wxWidgets and Cython

694 views
Skip to first unread message

Robert Bradshaw

unread,
Jul 23, 2012, 8:23:09 PM7/23/12
to cython...@googlegroups.com
On Tue, Jul 10, 2012 at 6:28 AM, Farmer
<das.ist....@googlemail.com> wrote:
> Hello,
> I try to use cython to make an interface between my C++/WxWidgets
> Application and my python scripts which will be executed with the embedded
> python interperter of my c++ application. My first step is to create a
> wxWindow in python and embedded this window in a wxWindow created form C++.
> It works with the low level C Api from python. But it is a lot of work. I
> think cython is much nicer. Is there a way to wrap a C++ function like this
>
> void EmbeddPyWxWindow(wxWindow* window)
>
> with cython. It would be nice if someone could help me.

It's really unclear what you're asking here, which is why I think no
one has responded. Are you trying to call EmbeddPyWxWindow from
Python? (In which case you need a way to represent a wxWindow* in
Python, e.g. a cdef class or c-capsule or something.

- Robert

Chris Barker

unread,
Jul 31, 2012, 1:55:36 PM7/31/12
to cython...@googlegroups.com
On Tue, Jul 31, 2012 at 2:57 AM, Farmer
<das.ist....@googlemail.com> wrote:

> Thank you for your feedback. I see isn't easy to understand what I meaned.
> So I try a new approach. My main goal is to have a C++/wxWidgets with an
> embedded python interperter. Furthermore I want to have access to the
> wxWidgets- classes from both worlds (C++ / Python). To create an interface
> between the worlds I want to use Cython.

hmm -- i"m a big Cython fan, but wxPython is built with SWIG, and
already gives you a pretty full wrapper around the C++ wx -- I"m not
sure there is a role for Cython here at all.

The only real "trick" here is to make sure you have a single version
of the C++ wx lib -- and that it's the patched version that works with
wxPython.

And if you don't like SWIG, the new (experimental version released)
version of wxPython used SIP instead (Robin looked at Cython, but with
such a big library, auto-generation of bindings was a compelling need
-- Cython doesn't have that (yet?)

So what role do you see Cython playing here?


One othere note:

Why have C++ as the host? It'd be a lot easier to write your app in
Python -- you may have very little need for C++ at all, and if you do,
it's easier to write a few extensions than to embed Python in C++.

-Chris






So my question is what is the best
> way to move the windows (type is wxWindow* in cpp, <wx._windows.Panel; proxy
> of <Swig Object of type 'wxPanel *'> > in Python) around? How do I get out
> my wxWindow* pointer form my python object?
>
> Best regards
> Farmer
>
> Am Dienstag, 24. Juli 2012 02:23:09 UTC+2 schrieb Robert Bradshaw:
>>
>> On Tue, Jul 10, 2012 at 6:28 AM, Farmer
--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages