Using Tk with C

J. C. Salomon picture J. C. Salomon · Dec 18, 2011 · Viewed 16k times · Source

I’m a C programmer with no desire to deal with C++ tool-kits, and I’m trying to build a simple graphical card game. I’m programming under Linux, but I’d like to have the option of a Windows port. From what I’ve read, my options are GTK+ and Tk.

I’m working through some GTK+ tutorials, and I’ll probably stick with that, but I don’t think I’m giving Tk a fair shot. Trouble is, all the Tk documentation I can find is either for using Tk with {Tcl, Ruby, Perl, Python}, or for embedding a Tcl interpreter into the C program and using Tk that way. Is there an easy(-ish) way to use Tk to build GUIs for a C program without digressing too much into Tcl?

Ideally, is there a tutorial (something along the lines of the TkDocs Tk Tutorial) but using something like the Tk C API?

Answer