Tkinter and C extensions

Andrew MacIntyre andymac at
Wed Apr 5 09:06:31 EDT 2000

I am looking at writing a C extension for python which links to a C
library (which is commercial and I don't have access to source), with a
python wrapper to tidy up a couple of rough edges.

This library can make use of an X "canvas", the details of which are
passed through an API function in terms of its X[lib|t] Display pointer 
and Window handle.

As I would like to direct the library to use a Tkinter canvas widget for
its display, I'm looking for a way to get these details about the target

My research has turned up ways of determining these via Tk's API
(Tk_Display(), Tk_Window() in tk.h) provided I can extract the tkwin
handle from Tkinter's canvas widget - something I've yet to figure out how
to do from within a C extension.

I'm wondering whether its possible to get at this information via Tkinter,
which would simplify the interactions between the various components.

I've perused the Fredrik's Tkinter docs, but I didn't find anything that
appeared to get close to what I think I'm looking for :-(.

I have downloaded the "Life preserver" stuff, but have yet to make much
headway with it.

I went looking for the GD module, which I thought might possibly have
done something like this, but following the link from the Vaults of
Parnassus yielded nothing.

Any hints on additional sources of enlightment, such as other modules
which have similarities, would be appreciated.

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andrew.macintyre at    (work) | Snail: PO Box 370
        andymac at  (play) |        Belconnen  ACT  2616
        andymac at           (play2) |        Australia

More information about the Python-list mailing list