python callbacks and windows

A.B., Khalid abkhd at earth.co.jp
Sun Sep 11 23:26:51 EDT 2005


davidstummer at gmail.com wrote:
> I was wondering if anyone could point me to an example. Currently i
> have a c++ program which calls and c++ dll (i created both). The dll
> uses SendMessage to pass messages back to the calling .exe, and the
> .exe process the messages in it's  Windows Procedure function
> WindProc().
>
> What i want is to receive these messages ( the contents of each message
> will be plain text), in python using a callback (i think this is what i
> need).
>
> I don't know whether (or if it's possible) to implement the windows
> procedure and stuff in python, eliminating the need for the .exe
> altogether.
>
> or should i do it the other way, to add a callback function in python,
> and for the windows procedure in the .exe to call this python callback?
>
> in any case, some simple code examples would be great.
>
> cheers.


What you ask for is somewhat hard to find easy answers for. But here is
something that might help:

1. Example of Python function to a C library as a callback:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/cd4a6aa29e75e72d/6c8eeeffba9fa14b?lnk=st&q=%22Python+function+to+a+C+library+as+a+callback%22&rnum=1&hl=en#6c8eeeffba9fa14b
2. Venster, a highly native Windows GUI toolkit for Python based on the
ctypes ffi library:
http://venster.sourceforge.net/htdocs/index.html



Khalid




More information about the Python-list mailing list