pythontkintergcctcl

Find location of tcl/tk header files


I'm trying to find a cross-platform way to find tcl.h and tk.h without having to search the entire system. I'm just wondering if there's a way to find this from Tcl or tkinter? root.tk.exprstring('$tcl_pkgPath') doesn't seem to include the right directories. Thanks!


Solution

  • The information you are looking for will be in the tclConfig.sh/tkConfig.sh files that describe how things are supposed to be built against (they're simples sourceable shell scripts). Those are not always present on the system (e.g., they'd be part of the ...-dev packages in some distributions) and may also be present multiple times if you have multiple installations on the system; I always had quite a few on my macOS machines.

    Because of the above situation, you have to tell build scripts where those files are. A simple search for them might not tell you which one to use (except in special circumstances, such as looking in a sibling directory) because the search can turn up the wrong ones, omit the right one, or order things weirdly.

    I've no idea how Tkinter handles this during its build. (I try to avoid looking a the build systems on the Python side of things. Gotta draw the line somewhere...)