From zabeehkhan at gmail.com Mon Feb 18 03:47:16 2008 From: zabeehkhan at gmail.com (zabeeh khan) Date: Sun, 17 Feb 2008 18:47:16 -0800 Subject: [capi-sig] Help me with Glade and Python Message-ID: Hello everyone, I have created the Graphical structure of my software with Glade and now want a little help from you. I use Windowx XP and have installed everything correctly and the newest versions..Python, PyGTK, Glade, all... I have attached the screenshot of the Glade project.. you can see it or you can see it here: www.pakhtosoft.com\gladeproject.JPG I have created two windows named mainWindow and aboutdialog and I want that when the About Names button is clicked from the mainWindow's toolbar it should load the aboutdialog and when the button Home Page is clicked from the mainWindow's toolbar it should also open the aboutdialog. Can you write this python script for me please?? I have named the click Handler for about button "on_aboutbtnclick" and for the homepage button I have named it "on_homepage_clicked". You can see the first one in the image too. Please anyone help me, please?? From paddy at earth.li Tue Feb 26 14:24:35 2008 From: paddy at earth.li (Patrick Moore) Date: Tue, 26 Feb 2008 13:24:35 +0000 Subject: [capi-sig] Passing Function Pointers from C to an embedded python environment Message-ID: <20080226132435.GA21619@the.earth.li> Hi All, I'm not sure if this is the right forum to be bringing this up in, but here goes anyway: I have a program which we're trying to embed python in, the goal being that we can use python to tweak various algorithms and extract data from the core system. To achieve this, and be able to access this data, it's my intention to pass call backs from the host C program into the python interpreter which will extract the data and form it into python objects for further processing -- typically displaying on a webserver etc ... Is there a sensible mechanism to acheive this, or is a different approach recommended? I've had a deep trawl through the extending and embedding document but nothing obvious has presented itself. All help and suggetions are gratefully received. Thanks in advance, paddy -- ----------( I've told you all my secrets, but I lied about )---------- ----------( my past, so send me off to bed for ever more ... )---------- From mhammond at skippinet.com.au Tue Feb 26 23:50:51 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 27 Feb 2008 09:50:51 +1100 Subject: [capi-sig] Passing Function Pointers from C to an embedded python environment In-Reply-To: <20080226132435.GA21619@the.earth.li> References: <20080226132435.GA21619@the.earth.li> Message-ID: <037501c878ca$0cc20d30$26462790$@com.au> > I'm not sure if this is the right forum to be bringing this up in, but > here > goes anyway: > > I have a program which we're trying to embed python in, the goal being > that we can use python to tweak various algorithms and extract data from > the core system. To achieve this, and be able to access this data, > it's my > intention to pass call backs from the host C program into the python > interpreter which will extract the data and form it into python objects > for further processing -- typically displaying on a webserver etc ... > > Is there a sensible mechanism to acheive this, or is a different > approach recommended? I've had a deep trawl through the > extending and embedding > document but nothing obvious has presented itself. All help and > suggetions are gratefully received. Off the top of my head, it sounds like you need to create your own PyObject implementation, which can hold your function pointers and make use of them via methods on the object. Alternatively, something like ctypes would let you call the function pointers directly, although without much safety - but depending on your requirements, that might be fine. Mark