Tk (software)

From Infogalactic: the planetary knowledge core
(Redirected from Tk)
Jump to: navigation, search

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Lua error in package.lua at line 80: module 'strict' not found.

Tk
Developer(s) John Ousterhout
Initial release 1991; 33 years ago (1991)
Stable release 8.6.5 / 29 February 2016; 8 years ago (2016-02-29)
Written in C
Operating system Cross-platform
Platform Cross-platform
Type Widget toolkit
License BSD-style[1]
Website www.tcl.tk

Tk is a free and open-source, cross-platform widget toolkit that provides a library of basic elements of GUI widgets for building a graphical user interface (GUI) in many programming languages.

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, Mac OS, Unix, and Microsoft 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). Tk was designed to be extended, and a wide range of extensions are available that offer new widgets or other capabilities.[citation needed]

A new theming engine, originally called Tk Tile,[2] but now generally referred to as "themed Tk", 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 Unix-like systems, Tk 8.4 and below still use bitmap fonts, but Tk 8.5 uses outline fonts (notably TrueType and OpenType fonts).[citation needed] Highlights of version 8.6 include PNG support and angled text.[3]

Architecture

Language bindings

A library written in one programming language may be used in another language if bindings are written; Tk has a range of bindings for various languages.[4]

Bindings exist for several other languages, including Ada (called TASH),[5] Haskell (called HTk),[6] Perl, Python (called Tkinter), Ruby, Rexx, and Common Lisp.

Uses

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

History

Tk was developed by John Ousterhout as an extension for the Tcl scripting language. It was first publicly released in 1991.[7] Tk versioning was done separately from Tcl until version 8.0.

Tk was written originally for Unix/X11, and proved extremely popular with programmers in the 1990s by virtue of it being significantly easier to learn and use than Motif and other dominant X11 toolkits of the time.[8] Tk was also ported to Microsoft Windows and Macintosh platforms, starting with Tk 4.2 and improved with native look and feel in Tk 8.0 (released 1997). The ease of use and cross-platform support, coupled with the ease of which Tk and its underlying Tcl interpreter could be embedded in other software, made it the de facto standard GUI toolkit among scripting languages.[citation needed]

Interest in Tk waned significantly from the late 1990s and onward. The default look and feel on Unix still emulated Motif, despite the mainstream replacement of Motif by toolkits such as Qt and GTK+. Widgets that became commonly used in applications (e.g. trees, combo boxes, tabbed notebooks) were not available in the Tk core, but only via multiple, often competing add-ons.[citation needed]

Tk 8.5, released in late 2007, corrected some of these problems by adding missing widgets to the core, introducing a new theming engine and modernizing the look and feel on Unix. However, because some code changes were required to incorporate these advancements, many existing applications retain the older Motif-inspired feel that Tk had become known for. Much of the older documentation found on the net was never updated to reflect the improvements, though the TkDocs site[9] does offer an up-to-date tutorial focused on modern best practices.[citation needed]

Architecture

Tk is a platform-independent GUI framework developed for Tcl. From a Tcl shell (tclsh), Tk may be invoked using the command package require Tk. The program wish (WIndowing SHell) provides a way to bring up a tclsh shell in a graphical window as well as providing Tk.[citation needed]

Tk has the following characteristics:[citation needed]

  • Platform-independent: Like Tcl, Tk is interpreted. It has been ported to multiple platforms and can easily run on all of them without modification.
  • Customizable: Almost all the features of a widget in Tk are customizable through options during the creation of the widget or later on through the configure command.
  • Configurable: Many of the options can be stored in an option database, making it very easy to parameterize the look of an application (such as the color scheme). This also means that storing the application-specific options is only a matter of saving the option add commands and executing them on loading the application.

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, as well as most other language bindings, use Tcl as a bridge to Tk.[citation needed]

Features

Tk provides the following widgets:[citation needed]

<templatestyles src="Div col/styles.css"/>

2

as well as the following top-level windows:

  • tk_chooseColor – pops up a dialog box for the user to select a color.
  • tk_chooseDirectory – pops up a dialog box for the user to select a directory.
  • tk_dialog – creates a modal dialog and waits for a response.
  • tk_getOpenFile – pops up a dialog box for the user to select a file to open.
  • tk_getSaveFile – pops up a dialog box for the user to select a file to save.
  • tk_messageBox – pops up a message window and waits for a user response.
  • tk_popup – posts a popup menu.
  • toplevel – creates and manipulates toplevel widgets.

Tk also provides three geometry managers:

  • place – which positions widgets at absolute locations
  • grid – which arranges widgets in a grid
  • pack – which packs widgets into a cavity

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.[clarification needed] There are many other useful widgets built on top of Tk such as TkTreeCtrl, BLT, Tix Mega-Widgets and TSIPP (a 3D Graphics Toolkit).[citation needed]

See also

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. https://www.tcl.tk/software/tcltk/8.6.html
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.

External links