beetlebug▾
/

winfo

Gives facts about widgets and the screen: the size, the position, the tree, the class, and the colors.

winfo SUBCOMMAND ?ARG ...?

Description

Each subcommand gives one fact and changes no state. Most subcommands take the name of a widget. The size and the position of a widget come from the last layout, so call update first for the current values. A widget that has had no layout has the size 1x1.

ztk has one display, with a true color visual of 24 bits and 96 pixels for each inch. The subcommands of the colormap, the visuals, and the virtual root of X11 give fixed values. -displayof is accepted where Tk has it, and has no effect.

Subcommands

SubcommandDescription
winfo atomGives the number of an atom name.
winfo atomnameGives the name of an atom number.
winfo cellsGives the count of cells in the colormap of a widget.
winfo childrenGives the child widgets of a widget, in the stacking order.
winfo classGives the class of a widget.
winfo colormapfullGives whether the colormap of a widget is full.
winfo containingGives the widget at a point of the screen.
winfo depthGives the count of bits for each pixel of a widget.
winfo existsGives whether a widget exists.
winfo fpixelsGives a screen distance in pixels.
winfo geometryGives the size and the position of a widget, in the form WIDTHxHEIGHT+X+Y.
winfo heightGives the height of a widget in pixels.
winfo idGives the identifier of the platform for a widget.
winfo interpsGives the names of the applications on the display.
winfo ismappedGives whether a widget is mapped.
winfo managerGives the geometry manager of a widget.
winfo nameGives the last part of the path name of a widget.
winfo parentGives the parent of a widget.
winfo pathnameGives the widget of an identifier of winfo id.
winfo pixelsGives a screen distance in whole pixels.
winfo pointerxGives the x position of the pointer on the screen.
winfo pointerxyGives the x and the y position of the pointer on the screen.
winfo pointeryGives the y position of the pointer on the screen.
winfo reqheightGives the height that a widget asks for, in pixels.
winfo reqwidthGives the width that a widget asks for, in pixels.
winfo rgbGives the red, green, and blue values of a color.
winfo rootxGives the x position of the left edge of a widget on the screen.
winfo rootyGives the y position of the top edge of a widget on the screen.
winfo screenGives the name of the screen of a widget.
winfo screencellsGives the count of cells in the default colormap of the screen.
winfo screendepthGives the count of bits for each pixel of the screen.
winfo screenheightGives the height of the screen in pixels.
winfo screenmmheightGives the height of the screen in millimeters.
winfo screenmmwidthGives the width of the screen in millimeters.
winfo screenvisualGives the class of the default visual of the screen.
winfo screenwidthGives the width of the screen in pixels.
winfo serverGives a description of the display server.
winfo toplevelGives the toplevel that contains a widget.
winfo viewableGives whether a widget and each of its ancestors are mapped.
winfo visualGives the class of the visual of a widget.
winfo visualidGives the identifier of the visual of a widget.
winfo visualsavailableGives the visuals of the screen of a widget.
winfo vrootheightGives the height of the virtual root window of a widget.
winfo vrootwidthGives the width of the virtual root window of a widget.
winfo vrootxGives the x offset of the virtual root window of a widget.
winfo vrootyGives the y offset of the virtual root window of a widget.
winfo widthGives the width of a widget in pixels.
winfo xGives the x position of the left edge of a widget in its parent.
winfo yGives the y position of the top edge of a widget in its parent.

Examples

% frame .f -width 40 -height 30
> pack .f
> update
> list [winfo width .f] [winfo height .f] [winfo manager .f] [winfo class .f]
40 30 pack Frame

Errors

% winfo
wrong # args: should be "winfo option ?arg?"
-errorcode TCL WRONGARGS

% winfo bogus
bad option "bogus": must be cells, children, class, colormapfull, depth, geometry, height, id, ismapped, manager, name, parent, pointerx, pointery, pointerxy, reqheight, reqwidth, rootx, rooty, screen, screencells, screendepth, screenheight, screenwidth, screenmmheight, screenmmwidth, screenvisual, server, toplevel, viewable, visual, visualid, vrootheight, vrootwidth, vrootx, vrooty, width, x, y, atom, atomname, containing, interps, pathname, exists, fpixels, pixels, rgb, or visualsavailable
-errorcode NONE

% winfo ch .
bad option "ch": must be cells, children, class, colormapfull, depth, geometry, height, id, ismapped, manager, name, parent, pointerx, pointery, pointerxy, reqheight, reqwidth, rootx, rooty, screen, screencells, screendepth, screenheight, screenwidth, screenmmheight, screenmmwidth, screenvisual, server, toplevel, viewable, visual, visualid, vrootheight, vrootwidth, vrootx, vrooty, width, x, y, atom, atomname, containing, interps, pathname, exists, fpixels, pixels, rgb, or visualsavailable
-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