## 8.9 Window-related information

All widgets have a `winfo(parameter1:variable1 ... parameterX:variableX)` method that obtains window-related information. `parameterX` must be a valid parameter for the `winfo`. `variableX` must be a free variable which will receive the current value of the parameter. The parameters for this method are:

- `cells`: Returns an integer giving the number of cells in the color map for window.

- `colormapfull`: Returns `true` if the colormap for window is known to be full, `false` otherwise. The colormap for a window is known to be full if the last attempt to allocate a new color on that window failed and this application hasn't freed any colors in the colormap since the failed allocation.

- `depth`: Returns an integer giving the depth of window (number of bits per pixel).

- `fpixels`: Returns a one-parameter function. Giving a valid screen distance to this function (see Section 8.6) returns a floating-point value giving the number of pixels in the widget corresponding to that distance. The return value may be fractional; for an integer value, use `winfo(pixels:V)`.

- `geometry`: Returns a record of the form `geometry(width:W height:H x:X y:Y)` describing the size and position of the widget inside its parent.

- `height`: Returns an integer giving widget's height in pixels. When a window is first created its height will be 1 pixel; the height will eventually be changed by a geometry manager to fulfill the window's needs. If you need the true height immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use `winfo(reqheight:N)` to get the window's requested height instead of its actual height.

- `id`: Returns a string giving a low-level platform-specific identifier for window. On Unix platforms, this is the X window identifier. Under Windows, this is the Windows HWND.

- `ismapped`: Returns `true` if the widget is currently mapped, `false` otherwise.

- `name`: Returns widget's Tk name (i.e. its name within its parent, as opposed to its full path name).

- `parent`: Returns the Tk path name of widget's parent, or an empty string if window is the main window of the application.

- `pixels`: Returns a one-parameter function. Giving a valid screen distance to this function (see Section 8.6) returns an integer value giving the number of pixels in the widget corresponding to that distance. The value is rounded to the nearest fractional value; for a fractional value, use `winfo(fpixels:V)`.

- `pointerx`: If the mouse pointer is on the same screen as the widget, returns an integer that is the pointer's x coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is measured in the virtual root. If the mouse pointer isn't on the same screen as the widget then -1 is returned.

- `pointery`: If the mouse pointer is on the same screen as the widget, returns an integer that is the pointer's y coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is measured in the virtual root. If the mouse pointer isn't on the same screen as the widget then -1 is returned.

- `pointerxy`: If the mouse pointer is on the same screen as the widget, returns a record of the form `pointerxy(x:X y:Y)` with `X` and `Y` being integers that are the pointer's coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is measured in the virtual root. If the mouse pointer isn't on the same screen as the widget then -1 is returned for both `X` and `Y`.

- `reqheight`: Returns an integer giving widget's requested height, in pixels. This is the value used by window's geometry manager to compute its geometry.

- `reqwidth`: Returns an integer giving widget's requested width, in pixels. This is the value used by window's geometry manager to compute its geometry.

- `rgb`: Returns a one-parameter function. Giving a valid color (see Section 8.2) to this function, it returns a record of the form `rgb(red:R green:G blue:B)` which are the red, green, and blue intensities that correspond to the color in the widget.

- `rootx`: Returns an integer giving the x-coordinate, in the root window of the screen, of the upper-left corner of the widget's border

- `rooty`: Returns an integer giving the y-coordinate, in the root window of the screen, of the upper-left corner of the widget's border

- `screen`: Returns a string that is the name of the screen associated with the widget, in the form displayName.screenIndex.

- `screencells`: Returns an integer giving the number of cells in the default color map for the widget's screen.

- `screendepth`: Returns a decimal string giving the depth of the root window of the widget's screen (number of bits per pixel).

- `screenheight`: Returns an integer giving the height of window's screen, in pixels.

- `screenmmheight`: Returns an integer giving the height of window's screen, in millimeters.

- `screenmmwidtht`: Returns an integer giving the width of window's screen, in millimeters.

- `screenvisual`: Returns one of the following atoms to indicate the default visual class for the widget's screen: `directcolor`, `grayscale`, `pseudocolor`, `staticcolor`, `staticgray`, or `truecolor`.

- `screenwidth`: Returns an integer giving the width of the widget's screen, in pixels.

- `server`: Returns a string containing information about the server for the widget's display. The exact format of this string may vary from platform to platform. For X servers the string has the form ``XmajorRminor vendor vendorVersion'' where major and minor are the version and revision numbers provided by the server (e.g., X11R5), vendor is the name of the vendor for the server, and vendorRelease is an integer release number provided by the server.

- `toplevel`: Returns a handle to the toplevel window of the widget.

- `viewable`: Returns `true` if the widget and all of its ancestors up through the nearest toplevel window are mapped. Returns `false` if any of these windows are not mapped.

- `visual`: Returns one of the following atoms to indicate the visual class for the widget: `directcolor`, `grayscale`, `pseudocolor`, `staticcolor`, `staticgray`, or `truecolor`.

- `visualid`: Returns a string that is the X identifier for the visual for the widget.

- `visualsavailable`: Returns a list of records of the form `visual(visual:A depth:I id:VS)` with `A` and atom describing a visual class, `I` an integer and `VS` a string which is an X identifier. The list is composed of all the different visuals available on the screen that display's the widget.

- `vrootheight`: Returns an integer that is the height of the virtual root window associated with the widget if there is one; otherwise returns the height of the widget's screen.

- `vrootwidth`: Returns an integer that is the width of the virtual root window associated with the widget if there is one; otherwise returns the width of the widget's screen.

- `vrootx`: Returns an integer that is the x-offset of the virtual root window associated with the widget, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for the widget.

- `vrooty`: Returns an integer that is the y-offset of the virtual root window associated with the widget, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for the widget.

- `width`: Returns an integer giving widget's width in pixels. When a window is first created its width will be 1 pixel; the width will eventually be changed by a geometry manager to fulfill the window's needs. If you need the true width immediately after creating a widget, invoke update to force the geometry manager to arrange it, or use `winfo(reqwidth:N)` to get the window's requested width instead of its actual width.

- `x`: Returns an integer giving the x-coordinate, in widget's parent, of the upper-left corner of widget's border.

- `y`: Returns an integer giving the y-coordinate, in widget's parent, of the upper-left corner of widget's border.