|previous : What is Tcl?||next : Who Uses Tcl|
Tk windowing toolkit, written in C, is designed to give the programmer a relatively high level interface to his or her windowing environment.Tk is equally available as a windowing toolkit for Tcl, Ruby, Perl, Python. TkDocs has the best overview of how this compares. Tk started life as a Tcl extension."Tk" occasionally is used when referring to
- the programming toolkit, available for many languages
- the Tk C library, which is available for applications built in such languages as C, Perl, and so on
- the wish interpreter which instantiates a Tk console
- the Tk extension, which adds a number of new commands to a particular Tcl interpreter
Tk in the Web BrowserTk applications run on the desktop, not in the browser. Strategically this means Tk apps will become less prevalent if most applications move to web-based software.Tk is not universally available for the browser, so programs written in Tk can only really work on the desktop.
- The TkPlugin is not available for the Mac
- Where it is available it is largely out of date.
- There does exist aejaks, a Tk-like bridge to Java-based echo widget set. Programs written in Tk will not work in Aejaks as the widget set is different.
- In 2000 there was an effort, named proxyTk, Proxy Tk to provide full-Tk in the browser. This effort has ceased.
- Your best bet is Porting a Tk GUI to A Web Browser, but then it won't work on the desktop
- In short, Tk is not a universal solution.
Source CodeYou can find the source code for Tk at http://sourceforge.net/projects/tktoolkit/ .
History of TkTk was written by John Ousterhout, the creator of Tcl. A PostScript version of the paper where Tk was introduced to the world can be found at ftp://www.tcl.tk/pub/tcl/doc/tkUsenix91.ps .The PostScript for slides used by Dr. John Ousterhout during USENIX tutorials on Tcl and Tk can be found at ftp://www.tcl.tk/pub/tcl/doc/tut.tar.Z .
Tk Widget SetTk allows you to create, manage, and manipulate widgets, rectangular areas on the screen with various features, from which you can build quite powerful GUIs with little effort.In Tk, the programmer only needs to specify how the widgets are arranged in a window (layout); the geometry of widgets is dynamic, so they can respond automatically both to changes in layout and to user resizing of windows.Some examples of widget types are:
- button (with text or image): executes a command when clicked
- label (with text or image): shows info, can be updated from a variable
- text widget: holds text in various fonts, colors, styles; can also hold embedded images and widgets; can wrap and/or be scrolled
- canvas: holds graphic objects (including text, images, widgets)
- listbox: holds text lines from which to select
- scrollbar: controls the display within another widget through the slider and the 2 arrows at each end.
- scale: horizontal or vertical, allows setting a numeric value [Isn't scale rather similar to scrollbar, though? Perhaps menu would be a better example of showing the breadth of the widget concept.]
Also of interest might be Alternate toolkit bindings, Common Tk Error Messages and Possible Explanations,
Alternate Widget SetsSee Alternate widget sets
See What is Tcl for information about the initial language that formed a basis for Tk.