Tk_ConfigureWindow(3)
π
β¨ Tk_ConfigureWindow(3) β Tk Library Procedures β¨π
okay bestie, welcome to the Tk_ConfigureWindow(3) page from the Tk Library Procedures β this is the whole squad of window-configuration glow-ups, and yes, they are iconic. π
πΈ NAME πΈ
Tk_ConfigureWindow, Tk_MoveWindow, Tk_ResizeWindow, Tk_MoveResizeWindow, Tk_SetWindowBorderWidth, Tk_ChangeWindowAttributes, Tk_SetWindowBackground, Tk_SetWindowBackgroundPixmap, Tk_SetWindowBorder, Tk_SetWindowBorderPixmap, Tk_SetWindowColormap, Tk_DefineCursor, and Tk_UndefineCursor β all of them change window configuration or attributes. periodt. π
β¨ SYNOPSIS β¨
#include <tk.h>
Tk_ConfigureWindow(tkwin, valueMask, valuePtr)
Tk_MoveWindow(tkwin, x, y)
Tk_ResizeWindow(tkwin, width, height)
Tk_MoveResizeWindow(tkwin, x, y, width, height)
Tk_SetWindowBorderWidth(tkwin, borderWidth)
Tk_ChangeWindowAttributes(tkwin, valueMask, attsPtr)
Tk_SetWindowBackground(tkwin, pixel)
Tk_SetWindowBackgroundPixmap(tkwin, pixmap)
Tk_SetWindowBorder(tkwin, pixel)
Tk_SetWindowBorderPixmap(tkwin, pixmap)
Tk_SetWindowColormap(tkwin, colormap)
Tk_DefineCursor(tkwin, cursor)
Tk_UndefineCursor(tkwin)
π ARGUMENTS π
Tk_Window tkwin(in) β Token for window. πͺunsigned int valueMask(in) β OR-ed mask of values likeCWXorCWBorderPixel, indicating which fields of*valuePtror*attsPtrto use. iykyk πXWindowChanges *valuePtr(in) β Points to a structure containing new values for the configuration parameters selected byvalueMask. Fields not selected byvalueMaskare ignored. lowkey selective, and honestly valid. β¨int x(in) β New x-coordinate fortkwin's top left pixel (including border, if any) withintkwin's parent.int y(in) β New y-coordinate fortkwin's top left pixel (including border, if any) withintkwin's parent.int width(in) β New width fortkwin(interior, not including border).int height(in) β New height fortkwin(interior, not including border).int borderWidth(in) β New width fortkwin's border. πXSetWindowAttributes *attsPtr(in) β Points to a structure containing new values for the attributes given by thevalueMaskargument. Attributes not selected byvalueMaskare ignored.unsigned long pixel(in) β New background or border color for window. color moment πPixmap pixmap(in) β New pixmap to use for background or border oftkwin. > β οΈ WARNING: cannot necessarily be deleted immediately, as for Xlib calls. See note below. π«ΆColormap colormap(in) β New colormap to use fortkwin. πTk_Cursor cursor(in) β New cursor to use fortkwin. IfNoneis specified, thentkwinwill not have its own cursor; it will use the cursor of its parent. π±οΈ
π¦ DESCRIPTION π¦
These procedures are analogous to the X library procedures with similar names, such as XConfigureWindow. it's giving βX library but make it Tk.β Each one of the above procedures calls the corresponding X procedure and also saves the configuration information in Tk's local structure for the window. That way the information can be retrieved quickly by the application β using macros such as Tk_X and Tk_Height β without having to contact the X server. fast, local, no server round-trip drama. β‘
In addition, if no X window has actually been created for tkwin yet, these procedures do not issue X operations or cause event handlers to be invoked; they save the information in Tk's local structure for the window; when the window is created later, the saved information will be used to configure the window. saving it for later, very main character energy. π
See the X library documentation for details on what these procedures do and how they use their arguments.
In the procedures Tk_ConfigureWindow, Tk_MoveWindow, Tk_ResizeWindow, Tk_MoveResizeWindow, and Tk_SetWindowBorderWidth, if tkwin is an internal window then event handlers interested in configure events are invoked immediately, before the procedure returns. If tkwin is a top-level window then the event handlers will be invoked later, after X has seen the request and returned an event for it. internal = immediate; top-level = later, bestie. π
Applications using Tk should never call procedures like XConfigureWindow directly; they should always use the corresponding Tk procedures. not me catching you trying to skip the Tk wrapper. don't. π
The size and location of a window should only be modified by the appropriate geometry manager for that window and never by a window itself (but see Tk_MoveToplevelWindow for moving a top-level window). let the geometry manager do its job, okay? π«Ά
You may not use Tk_ConfigureWindow to change the stacking order of a window (valueMask may not contain the CWSibling or CWStackMode bits). To change the stacking order, use the procedure Tk_RestackWindow. different tool, different slay. π
The procedure Tk_SetWindowColormap will automatically add tkwin to the TK_COLORMAP_WINDOWS property of its nearest top-level ancestor if the new colormap is different from that of tkwin's parent and tkwin is not already in the TK_COLORMAP_WINDOWS property. automatic colormap bookkeeping, we love to see it. π
π BUGS π
β οΈ bestie, read this before you free anything. β οΈ
Tk_SetWindowBackgroundPixmap and Tk_SetWindowBorderPixmap differ slightly from their Xlib counterparts in that the pixmap argument may not necessarily be deleted immediately after calling one of these procedures. This is because tkwin's window may not exist yet at the time of the call, in which case pixmap is merely saved and used later when tkwin's window is actually created. If you wish to delete pixmap, then call Tk_MakeWindowExist first to be sure that tkwin's window exists and pixmap has been passed to the X server. do the exist-check first, queen. π
A similar problem occurs for the cursor argument passed to Tk_DefineCursor. The solution is the same as for pixmaps above: call Tk_MakeWindowExist before freeing the cursor. same rule, same slay. π±οΈ
π SEE ALSO π
Tk_MoveToplevelWindowTk_RestackWindow
π₯ KEYWORDS π₯
attributes, border, color, configure, height, pixel, pixmap, width, window, x, y
β with love, Tk 4.0, your Tk_ConfigureWindow(3) page, signing off ππβ¨
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 1990-1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms