Tk Manual

Tk Manual

Alphabetical indices · Keywords
Tk built-in commands · General · Resources and Options · Widgets · Themed Widgets · Dialogs and toplevels · Geometry management · Events and bindings · Inter-client Communication · Tk C Procedures · Initialization · Widget Implementation · Themed Widget Implementation · Events and Bindings · Resources and Options · Images · Canvas Widgets · Graphics Routines · System-specific · Selection and Clipboard

Tk built-in commands


console - Control the console on systems without a real console
destroy - Destroy one or more windows
tk - Manipulate Tk internal state
tkerror - Command invoked to process background errors
tkvars - Variables used or set by Tk
tkwait - Wait for variable to change or window to be destroyed
winfo - Return window-related information
wish - Simple windowing shell
wm - Communicate with window manager

Resources and Options

bitmap - Images that display two colors
colors - symbolic color names recognized by Tk
cursors - mouse cursors available in Tk
font - Create and inspect fonts.
image - Create and manipulate images
keysyms - keysyms recognized by Tk
option - Add/retrieve window options to/from the option database
options - Standard options supported by widgets
tk_setPalette - Modify the Tk color palette
photo - Full-color images


button - Create and manipulate button widgets
canvas - Create and manipulate canvas widgets
checkbutton - Create and manipulate checkbutton widgets
entry - Create and manipulate entry widgets
frame - Create and manipulate frame widgets
label - Create and manipulate label widgets
labelframe - Create and manipulate labelframe widgets
listbox - Create and manipulate listbox widgets
menu - Create and manipulate menu widgets
menubutton - Create and manipulate menubutton widgets
message - Create and manipulate message widgets
tk_optionMenu - Create an option menubutton and its menu
panedwindow - Create and manipulate panedwindow widgets
radiobutton - Create and manipulate radiobutton widgets
scale - Create and manipulate scale widgets
scrollbar - Create and manipulate scrollbar widgets
spinbox - Create and manipulate spinbox widgets
text - Create and manipulate text widgets

Themed Widgets

ttk_button - Widget that issues a command when pressed
ttk_checkbutton - On/off widget
ttk_combobox - text field with popdown selection list
ttk_entry - Editable text field widget
ttk_frame - Simple container widget
ttk_image - Define an element based on an image
ttk_intro - Introduction to the Tk theme engine
ttk_label - Display a text string and/or image
ttk_labelframe - Container widget with optional label
ttk_menubutton - Widget that pops down a menu when pressed
ttk_notebook - Multi-paned container widget
ttk_panedwindow - Multi-pane container window
ttk_progressbar - Provide progress feedback
ttk_radiobutton - Mutually exclusive option widget
ttk_scrollbar - Control the viewport of a scrollable widget
ttk_separator - Separator bar
ttk_sizegrip - Bottom-right corner resize widget
ttk_spinbox - Selecting text field widget
ttk_style - Manipulate style database
ttk_treeview - hierarchical multicolumn data display widget
ttk_widget - Standard options and commands supported by Tk themed widgets

Dialogs and toplevels

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 - Create modal dialog and wait for response
tk_getOpenFile - pop up a dialog box for the user to select a file to open or save.
tk_messageBox - pops up a message window and waits for user response.
tk_popup - Post a popup menu
toplevel - Create and manipulate toplevel widgets

Geometry management

grid - Geometry manager that arranges widgets in a grid
lower - Change a window's position in the stacking order
pack - Geometry manager that packs around edges of cavity
place - Geometry manager for fixed or rubber-sheet placement
raise - Change a window's position in the stacking order

Events and bindings

bind - Arrange for X events to invoke Tcl scripts
bindtags - Determine which bindings apply to a window, and order of evaluation
event - Miscellaneous event facilities: define virtual events and generate events
focus - Manage the input focus
tk_focusNext - Utility procedures for managing the input focus.
grab - Confine pointer and keyboard events to a window sub-tree

Inter-client Communication

bell - Ring a display's bell
clipboard - Manipulate Tk clipboard
selection - Manipulate the X selection
send - Execute a command in a different application

Tk C Procedures


Tk_InitConsoleChannels - Install the console channels as standard channels
Tk_CreateErrorHandler - handle X protocol errors
Tk_MainLoop - loop for events until all windows are deleted
Tk_MainWindow - functions for querying main
Tk_ParseArgv - process command-line options
Tk_SetAppName - Set the name of an application for 'send' commands
Tk_StrictMotif - Return value of tk_strictMotif variable
Tk_InitStubs - initialize the Tk stubs mechanism
Tk_Init - add Tk to an interpreter and make a new Tk application.
Tk_Main - main program for Tk-based applications

Widget Implementation

Tk_CoordsToWindow - Find window containing a point
Tk_GeometryRequest - specify desired geometry or internal border for a window
Tk_GetAnchorFromObj - translate between strings and anchor positions
Tk_GetScrollInfo - parse arguments for scrolling commands
Tk_GetUid - convert from string to unique identifier
Tk_MaintainGeometry - maintain geometry of one window relative to another
Tk_ManageGeometry - arrange to handle geometry requests for a window
Tk_MapWindow - map or unmap a window
Tk_MoveToplevelWindow - Adjust the position of a top-level window
Tk_Name - convert between names and window tokens
Tk_RestackWindow - Change a window's position in the stacking order
Tk_SetClass - set or retrieve a window's class
Tk_SetClassProcs - register widget specific procedures
Tk_SetGrid - control the grid for interactive resizing
Tk_SetWindowVisual - change visual characteristics of window
Tk_WindowId - retrieve information from Tk's local data structure

Themed Widget Implementation

Ttk_MakeBox - Tk themed geometry utilities
Ttk_CreateTheme - create and use Tk themes.

Events and Bindings

Tk_CreateBindingTable - invoke scripts in response to X events
Tk_CreateEventHandler - associate procedure callback with an X event
Tk_Grab - manipulate grab state in an application
Tk_HandleEvent - invoke event handlers for window system events
Tk_GetUserInactiveTime - discover user inactivity time
Tk_QueueWindowEvent - Add a window event to the Tcl event queue
Tk_RestrictEvents - filter and selectively delay X events
Tk_SetCaretPos - set the display caret location

Resources and Options

Tk_AddOption - Add an option to the option database
Tk_ConfigureWidget - process configuration options for widgets
Tk_ConfigureWindow - change window configuration or attributes
Tk_CreateWindow - create or delete window
Tk_FontId - accessor functions for
Tk_GetOption - retrieve an option from the option database
Tk_SetOptions - process configuration options


Tk_CreateImageType - define new kind of image
Tk_CreateItemType - define new kind of canvas item
Tk_CreatePhotoImageFormat - define new file format for photo images
Tk_DeleteImage - Destroy an image.
Tk_FindPhoto - manipulate the image data stored in a photo image.
Tk_AllocBitmapFromObj - maintain database of single-plane pixmaps
Tk_ImageChanged - notify widgets that image needs to be redrawn
Tk_NameOfImage - Return name of image.

Canvas Widgets

Tk_CanvasPs - utility procedures for generating Postscript for canvases
Tk_CanvasTkwin - utility procedures for canvas type managers
Tk_CanvasTextInfo - additional information for managing text items in canvases

Graphics Routines

Tk_Alloc3DBorderFromObj - draw borders with three-dimensional appearance
Tk_DrawFocusHighlight - draw the traversal highlight ring for a widget
Tk_GetCapStyle - translate between strings and cap styles
Tk_GetColormap - allocate and free colormaps
Tk_AllocColorFromObj - maintain database of colors
Tk_AllocCursorFromObj - maintain database of cursors
Tk_GetDash - convert from string to valid dash structure.
Tk_AllocFontFromObj - maintain database of fonts
Tk_GetGC - maintain database of read-only graphics contexts
Tk_GetImage - use an image in a widget
Tk_GetJoinStyle - translate between strings and join styles
Tk_GetJustifyFromObj - translate between strings and justification styles
Tk_GetPixelsFromObj - translate between strings and screen units
Tk_GetPixmap - allocate and free pixmaps
Tk_GetReliefFromObj - translate between strings and relief values
Tk_GetRootCoords - Compute root-window coordinates of window
Tk_MeasureChars - routines to measure and display simple single-line strings.
Tk_ComputeTextLayout - routines to measure and display single-font, multi-line, justified text.


Tk_CreateClientMessageHandler - associate procedure callback with ClientMessage type X events
Tk_CreateGenericHandler - associate procedure callback with all X events
Tk_FreeXId - make X resource identifier available for reuse
Tk_GetHINSTANCE - retrieve the global application instance handle
Tk_GetHWND - manage interactions between the Windows handle and an X window
Tk_GetVRootGeometry - Get location and size of virtual root for window
Tk_GetVisual - translate from string to visual
Tk_HWNDToWindow - Find Tk's window information for a Windows window
Tk_IdToWindow - Find Tk's window information for an X window
Tk_InternAtom - manage cache of X atoms

Selection and Clipboard

Tk_ClipboardClear - Manage the clipboard
Tk_ClearSelection - Deselect a selection
Tk_CreateSelHandler - arrange to handle requests for a selection
Tk_GetSelection - retrieve the contents of a selection
Tk_OwnSelection - make a window the owner of the primary selection

Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1990-1994 The Regents of the University of California
Copyright © 1992-1999 Karl Lehenbauer and Mark Diekhans
Copyright © 1992-1999 Karl Lehenbauer and Mark Diekhans.
Copyright © 1993-1997 Bell Labs Innovations for Lucent Technologies
Copyright © 1994 The Australian National University
Copyright © 1994-2000 Sun Microsystems, Inc.
Copyright © 1997-2000 Ajuba Solutions.
Copyright © 1997-2000 Scriptics Corporation.
Copyright © 1998 Mark Harrison.
Copyright © 1998-1999 Scriptics Corporation
Copyright © 1998-1999 Scriptics Corportation
Copyright © 1995-1997 Roger E. Critchlow Jr.