python callbacks and windows

A.B., Khalid abkhd at
Mon Sep 12 05:26:51 CEST 2005

davidstummer at 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:
2. Venster, a highly native Windows GUI toolkit for Python based on the
ctypes ffi library:


More information about the Python-list mailing list