Jump to bottom
This article does not cite any references or sources.
Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (November 2009)
Tk Stable release 8.5.8 / November 17, 2009; 4 months ago (2009-11-17)
Operating system Cross-platform
Platform Cross-platform
Type Widget toolkit
License BSD-style
Website http://www.tcl.tk

Tk is an open source, cross-platform widget toolkit; that is, a library of basic elements for building a graphical user interface (GUI).

Tk provides a number of widgets commonly needed to develop desktop applications such as button, menu, canvas, text, frame, label etc. Tk has been ported to run on most flavors of Linux, Apple Macintosh, Unix, and Windows. Since Tcl/Tk 8, it offers "native look and feel" (for instance, menus and buttons are displayed in the manner of "native" software for any given platform). Also, there are several extensions to provide external drag-and-drop, non-rectangular windows, and native widgets. A new theming engine called Tk Tile is included in the 8.5 release. Like Tcl, Tk supports Unicode within the Basic Multilingual Plane but it has not yet been extended to handle 32-bit Unicode. On *nix systems, Tk 8.4 and below still use bitmap fonts, but Tk 8.5 uses outline fonts (notably TrueType and OpenType fonts).

History

Tk was developed by John Ousterhout as an extension for the Tcl scripting language. Bindings exist for several other languages, including Ada (called TASH), Perl, Python, Ruby, and Common Lisp. Tk versioning was done separately from Tcl until version 8.0.

Architecture

Tk is a platform-independent GUI framework for Tcl. Although Tk can be loaded from the Tcl shell (tclsh) by a "package require" Tk command, it is common to invoke it from the wish (Windowing Shell). It has the following characteristics:

There are several ways to use Tk from Perl: the Tcl::Tk and Tkx Perl modules, both of which use Tcl as a bridge to access Tk, and Perl/Tk, which provides native Perl access to Tk structures. The Python and Ruby bindings use Tcl as a bridge to Tk.

Features

Tk provides the following widgets:

as well as the following top-level windows:

Tk also provides three geometry managers:

The most unusual and versatile features of Tk are its canvas and text widgets, which provide capabilities found in few, if any other, widget toolkits.[citation needed]

Object-oriented widgets are available with incr Tk and Iwidgets. There are many other useful widgets built on top of Tk such as TkTreeCtrl, BLT (toolkit), Tix Mega-Widgets and TSIPP (a 3D Graphics Toolkit).

See also

Search Wikibooks Wikibooks has a book on the topic of
Tcl Programming/Tk

External links

List of Widget toolkits
Low-level
Macintosh Toolbox/Carbon · Windows API · Intrinsics · Intuition · Xlib

High-level
On Amiga OS
BOOPSI · Magic User Interface · Zune · ReAction GUI

On Mac OS
and Mac OS X
Cocoa · MacApp · MacZoop · PowerPlant

On Microsoft
Windows
Microsoft Foundation Class Library · Windows Template Library · SmartWin++ · Object Windows Library · Visual Component Library · Windows Forms · Windows Presentation Foundation

On Unix,
under X11
Athena/Xaw · Motif · LessTif · InterViews

Cross-platform,
by language
Flash
Adobe Flex · Gnash · SWF2EXE Software

XML, AJAX
or SVG
Ample SDK · CougarXML · Dojo Toolkit · Echo · Ext · GladeXML · jQuery · MooTools · Pyjamas · qooxdoo · Rialto Toolkit · script.aculo.us · XAML · XML User Interface · XUL · Google Web Toolkit · Yahoo! UI Library

Java
Abstract Window Toolkit · Swing · Standard Widget Toolkit · Qt Jambi

C or C++
CEGUI · Component Library for Cross Platform · FLTK · FOX toolkit · OpenGL User Interface Library · GTK+ · Juce · JX Application Framework · Qt · Tk · TnFOX · Visual Component Framework · wxWidgets · YAAF · XForms · XVT · Ultimate++

Common Lisp
CAPI · Common Graphics · CLIM · McCLIM · Garnet

Pascal
IP Pascal · Lazarus · fpGUI

Objective C
GNUstep