wxPython, C++ Integration

Hello All,

This is more of design question rather than UI related.

I have my UI implemented using wxPython and I need to integrate with a C++ library that communicates with network device drivers behind the scenes. There are two situations here: 1) Both the UI and the C++ library are on the same system 2) They are on different systems connected through IP remotely. Basically, the C++ tool has the Read and Write methods that I need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients simultaneously. In this case I guess I need to create a Python wrapper around or in front of the C++ tool to work like a server. Are there any python tools or design patterns to help? I don’t have any web development experience but I can put effort to learn. Your ideas will boost me certainly.

Thank you

Kotesh

Note, none of this is wx-specific, it might be worth inquiring on other fora.

But my thoughts anyway :

If you sometimes need to use a network protocol, you might as well always use it–even when everything is running on the same machine. It’s easy to spin up a sub-process and then talk to it on the localhost.

So what protocol to use?

If the C++ lib already supports one, use that. If not, then you have multiple options. I’d take a look at zeroMq:

http://zeromq.org

You could use C++ on the C++ side and Python on the other side.

You could also use plain TCP.

If you might want to use other, more generic clients or servers, then http could be a good idea. You could use the standard lib’s SimpleHttpServer, or one of the simple, fast web frameworks like flask or tornado.

If you need to put some python around the C++ (I write an http server in c++) then I suggest Cython for calling c++ from python. And maybe XDress for generating the Cython.

HTH,

-Chris

···

On Aug 21, 2014, at 5:54 PM, kruvva kruvva@gmail.com wrote:

Hello All,

This is more of design question rather than UI related.

I have my UI implemented using wxPython and I need to integrate with a C++ library that communicates with network device drivers behind the scenes. There are two situations here: 1) Both the UI and the C++ library are on the same system 2) They are on different systems connected through IP remotely. Basically, the C++ tool has the Read and Write methods that I need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients simultaneously. In this case I guess I need to create a Python wrapper around or in front of the C++ tool to work like a server. Are there any python tools or design patterns to help? I don’t have any web development experience but I can put effort to learn. Your ideas will boost me certainly.

Thank you

Kotesh

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I wrote a GUI a few years ago using Python and was using a C++ module that I compiled using the Boost library. You could also wrap any C++ functions with extern ‘C’ and then you can load that function directly with Python using ctypes.

···

On Thursday, August 21, 2014 5:54:34 PM UTC-7, kruvva wrote:

Hello All,

This is more of design question rather than UI related.

I have my UI implemented using wxPython and I need to integrate with a C++ library that communicates with network device drivers behind the scenes. There are two situations here: 1) Both the UI and the C++ library are on the same system 2) They are on different systems connected through IP remotely. Basically, the C++ tool has the Read and Write methods that I need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients simultaneously. In this case I guess I need to create a Python wrapper around or in front of the C++ tool to work like a server. Are there any python tools or design patterns to help? I don’t have any web development experience but I can put effort to learn. Your ideas will boost me certainly.

Thank you

Kotesh

Thank you Chris. That helps. I haven’t heard about zeroMQ. I’ll take a look. Is that an implementation of MPI?

···

On Friday, August 22, 2014 8:25:48 AM UTC-7, Chris Barker - NOAA Federal wrote:

Note, none of this is wx-specific, it might be worth inquiring on other fora.

But my thoughts anyway :

If you sometimes need to use a network protocol, you might as well always use it–even when everything is running on the same machine. It’s easy to spin up a sub-process and then talk to it on the localhost.

So what protocol to use?

If the C++ lib already supports one, use that. If not, then you have multiple options. I’d take a look at zeroMq:

http://zeromq.org

You could use C++ on the C++ side and Python on the other side.

You could also use plain TCP.

If you might want to use other, more generic clients or servers, then http could be a good idea. You could use the standard lib’s SimpleHttpServer, or one of the simple, fast web frameworks like flask or tornado.

If you need to put some python around the C++ (I write an http server in c++) then I suggest Cython for calling c++ from python. And maybe XDress for generating the Cython.

HTH,

-Chris

On Aug 21, 2014, at 5:54 PM, kruvva kru...@gmail.com wrote:

Hello All,

This is more of design question rather than UI related.

I have my UI implemented using wxPython and I need to integrate with a C++ library that communicates with network device drivers behind the scenes. There are two situations here: 1) Both the UI and the C++ library are on the same system 2) They are on different systems connected through IP remotely. Basically, the C++ tool has the Read and Write methods that I need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients simultaneously. In this case I guess I need to create a Python wrapper around or in front of the C++ tool to work like a server. Are there any python tools or design patterns to help? I don’t have any web development experience but I can put effort to learn. Your ideas will boost me certainly.

Thank you

Kotesh

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thank you Nathan. I’m sure this will help me in to start with.

···

On Friday, August 22, 2014 2:31:01 PM UTC-7, Nathan McCorkle wrote:

I wrote a GUI a few years ago using Python and was using a C++ module that I compiled using the Boost library. You could also wrap any C++ functions with extern ‘C’ and then you can load that function directly with Python using ctypes.

http://chimera.labs.oreilly.com/books/1230000000393/ch15.html

On Thursday, August 21, 2014 5:54:34 PM UTC-7, kruvva wrote:

Hello All,

This is more of design question rather than UI related.

I have my UI implemented using wxPython and I need to integrate with a C++ library that communicates with network device drivers behind the scenes. There are two situations here: 1) Both the UI and the C++ library are on the same system 2) They are on different systems connected through IP remotely. Basically, the C++ tool has the Read and Write methods that I need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients simultaneously. In this case I guess I need to create a Python wrapper around or in front of the C++ tool to work like a server. Are there any python tools or design patterns to help? I don’t have any web development experience but I can put effort to learn. Your ideas will boost me certainly.

Thank you

Kotesh

Thank you Chris. That helps. I haven't heard about zeroMQ. I'll take a
look. Is that an implementation of MPI?

nope -- it's a flexible low-overhead communication protocol.

I don't know much about it except that it has enabled some cool projects
like iPython.

-Chris

···

On Fri, Aug 22, 2014 at 5:03 PM, kruvva <kruvva@gmail.com> wrote:

On Friday, August 22, 2014 8:25:48 AM UTC-7, Chris Barker - NOAA Federal > wrote:

Note, none of this is wx-specific, it might be worth inquiring on other
fora.

But my thoughts anyway :

If you sometimes need to use a network protocol, you might as well always
use it--even when everything is running on the same machine. It's easy to
spin up a sub-process and then talk to it on the localhost.

So what protocol to use?

If the C++ lib already supports one, use that. If not, then you have
multiple options. I'd take a look at zeroMq:

http://zeromq.org

You could use C++ on the C++ side and Python on the other side.

You could also use plain TCP.

If you might want to use other, more generic clients or servers, then
http could be a good idea. You could use the standard lib's
SimpleHttpServer, or one of the simple, fast web frameworks like flask or
tornado.

If you need to put some python around the C++ (I write an http server in
c++) then I suggest Cython for calling c++ from python. And maybe XDress
for generating the Cython.

HTH,

-Chris

On Aug 21, 2014, at 5:54 PM, kruvva <kru...@gmail.com> wrote:

Hello All,

This is more of design question rather than UI related.
I have my UI implemented using wxPython and I need to integrate with a
C++ library that communicates with network device drivers behind the
scenes. There are two situations here: 1) Both the UI and the C++ library
are on the same system 2) They are on different systems connected through
IP remotely. Basically, the C++ tool has the Read and Write methods that I
need to trigger from the UI. What is the best way to integrate?

the In the future, the C++ tool needs to serve several clients
simultaneously. In this case I guess I need to create a Python wrapper
around or in front of the C++ tool to work like a server. Are there any
python tools or design patterns to help? I don't have any web development
experience but I can put effort to learn. Your ideas will boost me
certainly.

Thank you
Kotesh

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

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.Barker@noaa.gov