Or if you prefer not having to deal with Python's C API in exchange for having a bit of C++ in your wrappers, look into SWIG's directors.
-Matthias
···
Am 08.04.2009, 21:16 Uhr, schrieb Robin Dunn <robin@alldunn.com>:
Steve wrote:
Hello,
First off, thank you [list] for your help in the past. With your help, my GUI is working and looking great.
I have a problem that I am stuck on. I have some NesC code that subscribes to a database and lets me know every time the data has been changed. I would like to notify my GUI when it has been changed as well (eg motor position text field is updated when a motor has moved). I was thinking I would write a C routine that would be called, inside the NesC code, when the data is updated, and that C routine would then call a python routine to update a corresponding TextCntl field. I am not sure how to accomplish this.
I have read documentation on SWIG and read examples that show me how to make a call to a C function to retrieve the data but I want to avoid any timer if I can.
Any ideas or links to documents that might show how to accomplish this?See the Python/C API document at python.org. Assuming you have a PyObject pointer to some callable object (a function, bound method, etc.) then you can use one of the PyObject_Call* API functions to invoke it from your C code.