Tk_GeometryRequest(3tk)
π Tk_GeometryRequest β the "hey bestie can I be this big pls" manual page π
okay so this is a page from the Tk Library Procedures collection, and it's literally all about telling Tk how big you want your window to be, and how much internal border space to leave around the edges. no cap. π
β¨ NAME β¨
Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder, Tk_SetInternalBorderEx β specify desired geometry or internal border for a window π¦
πΈ SYNOPSIS πΈ
#include <tk.h>
Tk_GeometryRequest(tkwin, reqWidth, reqHeight)
Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight)
Tk_SetInternalBorder(tkwin, width)
Tk_SetInternalBorderEx(tkwin, left, right, top, bottom)
π«Ά ARGUMENTS π«Ά
Tk_Window tkwin(in) β the window we're out here requesting geometry for, bestie. πint reqWidth(in) β the width you want fortkwin, measured in pixel units. β¨int reqHeight(in) β the height you want fortkwin, in pixel units. πint minWidth(in) β the minimum requested width you desire fortkwin, in pixel units.int minHeight(in) β the minimum requested height you desire fortkwin, in pixel units.int width(in) β how much space to leave for the internal border oftkwin, in pixel units. πint left(in) β space to leave for the left side of the internal border fortkwin, in pixel units.int right(in) β space to leave for the right side of the internal border fortkwin, in pixel units.int top(in) β space to leave for the top side of the internal border fortkwin, in pixel units.int bottom(in) β space to leave for the bottom side of the internal border fortkwin, in pixel units.
π DESCRIPTION π
Tk_GeometryRequest is the one widget code calls when it wants to be like "hi yes I would love these dimensions for this specific window, thank u". π The arguments you hand to Tk_GeometryRequest get passed along to the geometry manager for that window, and then the geometry manager decides what the actual geometry is gonna be. so it's giving "I have opinions" not "I make the rules".
and here's the thing: even though geometry managers generally do try to satisfy the requests you make to Tk_GeometryRequest, there is no guarantee it'll always be possible. π like, they'll try their best, but bestie, no promises.
so widget code should not assume a geometry request was satisfied until it gets a ConfigureNotify event saying the geometry change actually happened. that's the receipt. no receipt, no assumption. π§Ύ
also, widget code should never call procedures like Tk_ResizeWindow directly. π instead, invoke Tk_GeometryRequest and let the geometry manager make the final geometry decisions. stay in your lane, let the manager cook. π
if tkwin is a top-level window, then the geometry information gets passed to the window manager using the standard ICCCM protocol. fancy. iconic. β¨
Tk_SetInternalBorder is what widget code calls to say "hey, I have an internal border." π this means the widget draws a decorative border inside the window, instead of using the standard X borders, which are external to the window's area. for example, internal borders are used to draw 3-D effects. π width specifies the width of the border in pixels. geometry managers will use this info to avoid placing any children of tkwin overlapping the outermost width pixels of tkwin's area. so like, personal space, respected. π«Ά
Tk_SetInternalBorderEx works like Tk_SetInternalBorder but lets you specify different widths for different sides of the window. so you can be asymmetric about it. main character energy. π
Tk_SetMinimumRequestSize is what widget code calls to tell a geometry manager "you should request at least this size for the widget." π this lets a widget have some control over its size when a propagating geometry manager is used inside it. slay. β¨
the info you specified in calls to Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder and Tk_SetInternalBorderEx can be retrieved using the macros Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_MinReqWidth, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop and Tk_InternalBorderBottom. π see the Tk_WindowId manual entry for details, iykyk.
β KEYWORDS β
geometry, request
okay that's the whole page, bestie, you ate it up fr fr π huge thanks to Tk, version 8.4, for blessing us with this documentation, and shoutout to the Tk_GeometryRequest(3tk) page itself for keeping it real. mwah. ππΈ
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1990-1994 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms