A complete C++ interface to the Tk GUI toolkit
|C++/Tk is an interface to the Tk
GUI toolkit, known from many scripting languages like Tcl, Python or
The C++/Tk library tries to provide not only the Tk functionality, but also its way of writing code, based on the syntax used in Tcl/Tk.
As a result, it is possible to write programming jokes like this
(in fact, the whole C++/Tk library started from this joke):
Apart from the scaffolding necessary in C++, both programs look almost the same and produce the same result (the actual look and feel depends on the platform, window manager, etc.):
If you click the button, the greetings will be printed on the console.
Interesting? See more examples, which include text editor, math animation and the Game of Life!
How does it work?
It works thanks to templates, operator overloading, implicit conversions and temporary objects.
Each C++/Tk expression ends up as equivalent Tcl/Tk command in the string format, which is then fed to the underlying Tcl interpreter.
This means that C++/Tk uses and depends on the Tcl/Tk environment.
It also means that C++/Tk is portable in the same way as Tcl/Tk.
The added values are: