beetlebug▾
/

wm

Gives or sets the properties of a toplevel window: the title, the size, the state, and the hints for the window manager.

wm SUBCOMMAND WINDOW ?ARG ...?

Description

Each subcommand works on WINDOW, which is . or a widget of toplevel. Another widget gives the error window "WINDOW" isn't a top-level window. A subcommand name can be a unique short form, such as ti for title.

A subcommand with an optional value sets the value when the call gives it, and gives the current value when the call does not. Some subcommands are hints of X11 for the window manager, such as wm client or wm iconposition: ztk stores their values and gives them back, with no effect on the window. Each subcommand below says which kind it is.

A close request of the platform, such as a click on the close button, runs the script of wm protocol WINDOW WM_DELETE_WINDOW, or destroys the window when it has no script.

Subcommands

SubcommandDescription
wm aspectGives or sets the limits of the ratio of width to height of a toplevel.
wm attributesGives or sets the attributes of a toplevel that depend on the platform.
wm clientGives or sets the name of the host of the application, for the window manager.
wm colormapwindowsGives or sets the widgets with their own colormap, for the window manager.
wm commandGives or sets the command that starts the application, for a session manager.
wm deiconifyShows a withdrawn or iconified toplevel in its normal state.
wm focusmodelGives or sets the focus model of a toplevel: active or passive.
wm forgetMakes a toplevel a normal widget, in Tk.
wm frameGives the identifier of the outer frame of a toplevel.
wm geometryGives or sets the size and the position of a toplevel.
wm gridGives or sets the grid of a toplevel, so that its size goes in steps of a cell.
wm groupGives or sets the leader of the group of a toplevel.
wm iconbitmapGives or sets a bitmap for the icon of a toplevel.
wm iconifyMakes a toplevel an icon.
wm iconmaskGives or sets a bitmap for the shape of the icon of a toplevel.
wm iconnameGives or sets the name under the icon of a toplevel.
wm iconphotoSets the icon of a toplevel from photo images.
wm iconpositionGives or sets the place of the icon of a toplevel on the screen.
wm iconwindowGives or sets a widget to show as the icon of a toplevel.
wm manageMakes a widget a toplevel, in Tk.
wm maxsizeGives or sets the largest size of a toplevel.
wm minsizeGives or sets the smallest size of a toplevel.
wm overrideredirectGives or sets whether a toplevel has no title bar and no frame of the window manager.
wm positionfromGives or sets who asked for the position of a toplevel: program or user.
wm protocolGives or sets the script for a request of the window manager, such as a click on the close button.
wm resizableGives or sets whether the user can change the width and the height of a toplevel.
wm sizefromGives or sets who asked for the size of a toplevel: program or user.
wm stackorderGives the toplevels in the stacking order, from the bottom to the top.
wm stateGives or sets the state of a toplevel: normal, iconic, withdrawn, or zoomed.
wm titleGives or sets the title of a toplevel.
wm transientGives or sets the window that a dialog belongs to.
wm withdrawRemoves a toplevel from the screen.

Examples

% toplevel .dlg
> wm title .dlg Settings
> wm geometry .dlg 300x200
> update
> list [wm title .dlg] [winfo width .dlg] [winfo height .dlg]
Settings 300 200

Errors

% wm
wrong # args: should be "wm option window ?arg ...?"
-errorcode TCL WRONGARGS

% wm bogus .
bad option "bogus": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw
-errorcode NONE

% frame .f
> wm title .f
window ".f" isn't a top-level window
-errorcode NONE

% wm title .nope
bad window path name ".nope"
-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