beetlebug▾
/

tk

Gives and sets facts of the app: its name, its scale, its windowing system, and the state of the input.

tk SUBCOMMAND ?ARG ...?

Description

The subcommands of tk work on the app as a whole. Some give facts of the platform, such as tk windowingsystem and tk touchscreen. Others keep a state for the scripts of Tk, such as tk busy and tk caret, with less effect in ztk than in Tk. The page of each subcommand says what has an effect.

tk appdata, tk insets, and tk touchscreen are subcommands of ztk for apps on phones and other platforms. Tk 8.6.16 does not have them.

A short form of a subcommand works when it matches one subcommand only, such as tk appn for tk appname. tk app is an error, because it matches appdata and appname.

Subcommands

SubcommandDescription
tk appnameGives or sets the name of the app.
tk scalingGives or sets the count of pixels in one point.
tk windowingsystemGives the name of the windowing system of the app.
tk appdataGives the folder of the platform for the data of the app.
tk insetsGives the parts of a toplevel under the bars of the system and the soft keyboard.
tk touchscreenTells if the backend has a touch screen.
tk busyMarks a window as busy, and gives the busy windows.
tk caretGives or sets the place of the text cursor of a window, for the input methods and the screen readers.
tk fontchooserShows the font dialog of the platform, and keeps its options.
tk inactiveGives the time since the last input of the user.
tk useinputmethodsGives or sets a flag for the use of input methods.

Examples

% expr {[tk windowingsystem] in {x11 win32 aqua}}
1

Errors

% tk
wrong # args: should be "tk subcommand ?arg ...?"
-errorcode TCL WRONGARGS

% tk print .
unknown or ambiguous subcommand "print": must be appdata, appname, busy, caret, fontchooser, inactive, insets, scaling, touchscreen, useinputmethods, or windowingsystem
-errorcode NONE

Differences from Tcl

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also