Trouble Importing Tkinter in embedded C program

David Boddie davidb at dcs.st-and.ac.uk
Tue Nov 18 17:04:29 EST 2003


Rick Olson wrote:

> I'm trying to add a Tkinter interface to an existing C program with
> embedded python, but seem to have trouble importing Tkinter (or
> accessing it).

[...]

Sounds like a fairly familiar issue with compiled extensions, but I could
be wrong.

> Using Py_GetPath reported:
> 
>
/usr/lib/python2.2/:/usr/lib/python2.2/plat-linux2:/usr/lib/python2.2/lib-tk:
> /usr/lib/python2.2/lib-dynload
> 
> On my SuSE 8.2 installation Tkinter.py is in usr/lib/python2.2/lib-tk/

[...]

> Can someone guide me in the right direction to allow calls to Tkinter
> through the embedded python?  I know there are ways of using Tk/Tcl
> through C, but I'm not familiar enough with Tk/Tcl to try that.

If you are able to change the conditions under which the C program is
built (paths, libraries, etc.) then you may want to link against the
_tkinter.so library in the /usr/lib/python2.2/lib-dynload directory.

That's just a guess, however. Maybe this is answered in an FAQ somewhere.

-- 
http://www.boddie.org.uk/david/Projects/




More information about the Python-list mailing list