options(3tk)
β¨ NAME β¨
options β standard options supported by widgets. π
πΈ DESCRIPTION πΈ
Okay bestie, gather round. This man page is the master list of the common configuration options supported by widgets in the Tk toolkit. Every widget does not necessarily support every single option β if you need the receipts for a specific widget, check the manual entries for individual widgets for the list of the standard options supported by that widget. But if a widget does support an option with one of the names listed below, then that option has exactly the effect described below. Periodt. π
In the descriptions below, βCommand-Line Nameβ is the switch used in class commands and configure widget commands to set this value. For example, if an option's command-line switch is -foreground and there exists a widget .a.b.c, then this command:
.a.b.c configure -foreground black
may be used to specify the value black for the option in the widget .a.b.c. Command-line switches may be abbreviated, as long as the abbreviation is unambiguous. βDatabase Nameβ refers to the option's name in the option database (e.g. in .Xdefaults files). βDatabase Classβ refers to the option's class value in the option database. Slay. β¨
π OPTIONS π
-activebackgroundβ specifies the background color to use when drawing active elements. An element (a widget or portion of a widget) is active if the mouse cursor is positioned over the element and pressing a mouse button will cause some action to occur. If strict Motif compliance has been requested by setting thetk_strictMotifvariable, this option will normally be ignored; the normal background color will be used instead. For some elements on Windows and Macintosh systems, the active color will only be used while mouse button 1 is pressed over the element. π- Database Name:
activeBackground - Database Class:
Foreground
- Database Name:
-activeborderwidthβ specifies a non-negative value indicating the width of the 3-D border drawn around active elements. See above for definition of active elements. The value may have any of the forms acceptable toTk_GetPixels. This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). β¨- Database Name:
activeBorderWidth - Database Class:
BorderWidth
- Database Name:
-activeforegroundβ specifies foreground color to use when drawing active elements. See above for definition of active elements. πΈ- Database Name:
activeForeground - Database Class:
Background
- Database Name:
-activereliefβ specifies the 3-D effect desired for the active item of the widget. See the-reliefoption for details. π- Database Name:
activeRelief - Database Class:
Relief
- Database Name:
-anchorβ specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the valuesn,ne,e,se,s,sw,w,nw, orcenter. For example,nwmeans display the information such that its top-left corner is at the top-left corner of the widget. π¦- Database Name:
anchor - Database Class:
Anchor
- Database Name:
-backgroundor-bgβ specifies the normal background color to use when displaying the widget. π- Database Name:
background - Database Class:
Background
- Database Name:
-bitmapβ specifies a bitmap to display in the widget, in any of the forms acceptable toTk_GetBitmap. The exact way in which the bitmap is displayed may be affected by other options such as-anchoror-justify. Typically, if this option is specified then it overrides other options that specify a textual value to display in the widget but this is controlled by the-compoundoption; the-bitmapoption may be reset to an empty string to re-enable a text display. In widgets that support both-bitmapand-imageoptions,-imagewill usually override-bitmap. π- Database Name:
bitmap - Database Class:
Bitmap
- Database Name:
-borderwidthor-bdβ specifies a non-negative value indicating the width of the 3-D border to draw around the outside of the widget (if such a border is being drawn; the-reliefoption typically determines this). The value may also be used when drawing 3-D effects in the interior of the widget. The value may have any of the forms acceptable toTk_GetPixels. π- Database Name:
borderWidth - Database Class:
BorderWidth
- Database Name:
-cursorβ specifies the mouse cursor to be used for the widget. The value may have any of the forms acceptable toTk_GetCursor. In addition, if an empty string is specified, it indicates that the widget should defer to its parent for cursor specification. β¨- Database Name:
cursor - Database Class:
Cursor
- Database Name:
-compoundβ specifies if the widget should display text and bitmaps/images at the same time, and if so, where the bitmap/image should be placed relative to the text. Must be one of the valuesnone,bottom,top,left,right, orcenter. For example, the (default) valuenonespecifies that the bitmap or image should (if defined) be displayed instead of the text, the valueleftspecifies that the bitmap or image should be displayed to the left of the text, and the valuecenterspecifies that the bitmap or image should be displayed on top of the text. πΈ- Database Name:
compound - Database Class:
Compound
- Database Name:
-disabledforegroundβ specifies foreground color to use when drawing a disabled element. If the option is specified as an empty string (which is typically the case on monochrome displays), disabled elements are drawn with the normal foreground color but they are dimmed by drawing them with a stippled fill pattern. π- Database Name:
disabledForeground - Database Class:
DisabledForeground
- Database Name:
-exportselectionβ specifies whether or not a selection in the widget should also be the X selection. The value may have any of the forms accepted byTcl_GetBoolean, such astrue,false,0,1,yes, orno. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. The default is usually for widgets to export selections. π«Ά- Database Name:
exportSelection - Database Class:
ExportSelection
- Database Name:
-fontβ specifies the font to use when drawing text inside the widget. The value may have any of the forms described in thefontmanual page under FONT DESCRIPTION. π₯- Database Name:
font - Database Class:
Font
- Database Name:
-foregroundor-fgβ specifies the normal foreground color to use when displaying the widget. π- Database Name:
foreground - Database Class:
Foreground
- Database Name:
-highlightbackgroundβ specifies the color to display in the traversal highlight region when the widget does not have the input focus. π- Database Name:
highlightBackground - Database Class:
HighlightBackground
- Database Name:
-highlightcolorβ specifies the color to use for the traversal highlight rectangle that is drawn around the widget when it has the input focus. β¨- Database Name:
highlightColor - Database Class:
HighlightColor
- Database Name:
-highlightthicknessβ specifies a non-negative value indicating the width of the highlight rectangle to draw around the outside of the widget when it has the input focus. The value may have any of the forms acceptable toTk_GetPixels. If the value is zero, no focus highlight is drawn around the widget. π- Database Name:
highlightThickness - Database Class:
HighlightThickness
- Database Name:
-imageβ specifies an image to display in the widget, which must have been created with theimage createcommand. Typically, if the-imageoption is specified then it overrides other options that specify a bitmap or textual value to display in the widget, though this is controlled by the-compoundoption; the-imageoption may be reset to an empty string to re-enable a bitmap or text display. π- Database Name:
image - Database Class:
Image
- Database Name:
-insertbackgroundβ specifies the color to use as background in the area covered by the insertion cursor. This color will normally override either the normal background for the widget (or the selection background if the insertion cursor happens to fall in the selection). π- Database Name:
insertBackground - Database Class:
Foreground
- Database Name:
-insertborderwidthβ specifies a non-negative value indicating the width of the 3-D border to draw around the insertion cursor. The value may have any of the forms acceptable toTk_GetPixels. β¨- Database Name:
insertBorderWidth - Database Class:
BorderWidth
- Database Name:
-insertofftimeβ specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain βoffβ in each blink cycle. If this option is zero then the cursor does not blink: it is on all the time. π- Database Name:
insertOffTime - Database Class:
OffTime
- Database Name:
-insertontimeβ specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain βonβ in each blink cycle. π₯- Database Name:
insertOnTime - Database Class:
OnTime
- Database Name:
-insertwidth- Database Name:
insertWidth - Database Class:
InsertWidth
- Database Name:
Specifies a non-negative value indicating the total width of the insertion cursor. The value may have any of the forms acceptable to Tk_GetPixels. If a border has been specified for the insertion cursor (using the -insertborderwidth option), the border will be drawn inside the width specified by the -insertwidth option. π
-jumpβ Command-Line Name:-jumpΒ· Database Name:jumpΒ· Database Class:Jump- For widgets rockin' a slider you can drag around to adjust a value (scrollbars, hi bestie π«Ά), this option decides when you get notified about value changes. Its value has to be a boolean of the form
Tcl_GetBooleanaccepts. If it's false, updates happen continuously while you drag the slider. If it's true, the updates get delayed until you release the mouse button and the drag ends β and at that exact moment one single notification drops, so the value literally "jumps" instead of sliding smoothly. no cap β¨
- For widgets rockin' a slider you can drag around to adjust a value (scrollbars, hi bestie π«Ά), this option decides when you get notified about value changes. Its value has to be a boolean of the form
-justifyβ Command-Line Name:-justifyΒ· Database Name:justifyΒ· Database Class:Justify- When a widget is showing multiple lines of text, this option says how those lines line up with each other. Gotta be one of
left,center, orright.leftmeans all the left edges line up,centermeans the centers are aligned, andrightmeans the right edges line up. it's giving β¨alignmentβ¨
- When a widget is showing multiple lines of text, this option says how those lines line up with each other. Gotta be one of
-orientβ Command-Line Name:-orientΒ· Database Name:orientΒ· Database Class:Orient- For widgets that can lay themselves out either horizontally or vertically (scrollbars, looking at you π), this one picks which orientation gets used. Must be either
horizontalorvertical, or an abbreviation of one of those two. π«
- For widgets that can lay themselves out either horizontally or vertically (scrollbars, looking at you π), this one picks which orientation gets used. Must be either
-padxβ Command-Line Name:-padxΒ· Database Name:padXΒ· Database Class:Pad- Specifies a non-negative value for how much extra space to request for the widget in the X-direction. Value can be in any form
Tk_GetPixelsaccepts. When the widget is figuring out how big a window it needs, it adds this amount to the width it would normally need (that width coming from the things displayed inside it); if the geometry manager can actually satisfy that request, the widget ends up with extra internal space to the left and/or right of what it's displaying. Most widgets only use this for padding text: if they're showing a bitmap or an image, they usually just ignore the padding options entirely. π
- Specifies a non-negative value for how much extra space to request for the widget in the X-direction. Value can be in any form
-padyβ Command-Line Name:-padyΒ· Database Name:padYΒ· Database Class:Pad- Specifies a non-negative value for how much extra space to request for the widget in the Y-direction. Value can be in any form
Tk_GetPixelsaccepts. When the widget is computing how big a window it needs, it adds this amount to the height it would normally need (determined by the height of the stuff displayed inside it); if the geometry manager can satisfy that request, the widget ends up with extra internal space above and/or below what it's displaying. Most widgets only use this for padding text: if they're showing a bitmap or image, they usually ignore the padding options. same energy as-padxfr fr π¦
- Specifies a non-negative value for how much extra space to request for the widget in the Y-direction. Value can be in any form
-placeholderβ Command-Line Name:-placeholderΒ· Database Name:placeHolderΒ· Database Class:PlaceHolder- Specifies a help-text string to display when no text is otherwise being displayed β i.e. when the widget is empty. That placeholder text gets rendered using the values of the
-fontand-justifyoptions. so cute π
- Specifies a help-text string to display when no text is otherwise being displayed β i.e. when the widget is empty. That placeholder text gets rendered using the values of the
-placeholderforegroundβ Command-Line Name:-placeholderforegroundΒ· Database Name:placeholderForegroundΒ· Database Class:PlaceholderForeground- Specifies the foreground color to use while the placeholder text is being displayed. The default color is platform-specific β so don't come for me, it depends on your setup π
-reliefβ Command-Line Name:-reliefΒ· Database Name:reliefΒ· Database Class:Relief- Specifies the 3-D effect the widget should have. Acceptable values are
raised,sunken,flat,ridge,solid, andgroove. The value says how the interior of the widget should look compared to its exterior; for example,raisedmeans the inside of the widget should appear to pop out from the screen relative to the outside of the widget. main character energy honestly π
- Specifies the 3-D effect the widget should have. Acceptable values are
-repeatdelayβ Command-Line Name:-repeatdelayΒ· Database Name:repeatDelayΒ· Database Class:RepeatDelay- Specifies the number of milliseconds a button or key has to be held down before it starts to auto-repeat. Used, for example, on the up- and down-arrows in scrollbars. β±οΈ
-repeatintervalβ Command-Line Name:-repeatintervalΒ· Database Name:repeatIntervalΒ· Database Class:RepeatInterval- Used together with
-repeatdelay: once auto-repeat kicks off, this option sets the number of milliseconds between each auto-repeat. the duo we didn't know we needed π«Ά
- Used together with
-selectbackgroundβ Command-Line Name:-selectbackgroundΒ· Database Name:selectBackgroundΒ· Database Class:Foreground- Specifies the background color to use when displaying selected items. π
-selectborderwidthβ Command-Line Name:-selectborderwidthΒ· Database Name:selectBorderWidthΒ· Database Class:BorderWidth- Specifies a non-negative value indicating the width of the 3-D border to draw around selected items. The value may take any of the forms acceptable to
Tk_GetPixels. β¨
- Specifies a non-negative value indicating the width of the 3-D border to draw around selected items. The value may take any of the forms acceptable to
-selectforegroundβ Command-Line Name:-selectforegroundΒ· Database Name:selectForegroundΒ· Database Class:Background- Specifies the foreground color to use when displaying selected items. π
-setgridβ Command-Line Name:-setgridΒ· Database Name:setGridΒ· Database Class:SetGrid- Specifies a boolean value that decides whether this widget controls the resizing grid for its top-level window. This option is typically used in text widgets, where the info in the widget has a natural size (the size of a character) and it just makes sense for the window's dimensions to be integral numbers of those units. Those natural window sizes form a grid. If
-setgridis true, the widget talks to the window manager so that when the user interactively resizes the top-level window containing the widget, the window's dimensions get displayed to the user in grid units and the window size gets constrained to integral numbers of grid units. Peep the section GRIDDED GEOMETRY MANAGEMENT in thewmmanual entry for more details. π¦
- Specifies a boolean value that decides whether this widget controls the resizing grid for its top-level window. This option is typically used in text widgets, where the info in the widget has a natural size (the size of a character) and it just makes sense for the window's dimensions to be integral numbers of those units. Those natural window sizes form a grid. If
-takefocusβ Command-Line Name:-takefocusΒ· Database Name:takeFocusΒ· Database Class:TakeFocus- Decides whether the window accepts the focus during keyboard traversal (think Tab and Shift-Tab). Before focusing a window, the traversal scripts check the value of the
-takefocusoption. A value of0means the window should be skipped entirely during keyboard traversal.1means the window should receive the input focus as long as it's viewable (it and all of its ancestors are mapped). An empty value means the traversal scripts make the call themselves on whether or not to focus the window: the current algorithm is to skip the window if it's disabled, if it has no key bindings, or if it's not viewable. If the value is any other form, the traversal scripts take that value, append the name of the window to it (with a separator space), and evaluate the resulting string as a Tcl script. That script must return0,1, or an empty string:0or1says whether the window will receive the input focus, and an empty string falls back to the default decision described above. Heads up bestie β this interpretation of the option is defined entirely by the Tcl scripts that implement traversal: the widget implementations ignore the option completely, so you can change what it means if you redefine the keyboard traversal scripts. π
- Decides whether the window accepts the focus during keyboard traversal (think Tab and Shift-Tab). Before focusing a window, the traversal scripts check the value of the
iykyk: the widgets themselves literally do not care about this option. it's all the scripts, periodt.
-textβ Command-Line Name:-textΒ· Database Name:textΒ· Database Class:Text- Specifies a string to display inside the widget. How that string gets displayed depends on the particular widget, and may also be decided by other options like
-anchoror-justify. πΈ
- Specifies a string to display inside the widget. How that string gets displayed depends on the particular widget, and may also be decided by other options like
-textvariableβ Command-Line Name:-textvariableΒ· Database Name:textVariableΒ· Database Class:Variable- Specifies the name of a global variable. The value of that variable is a text string to be displayed inside the widget; if the variable's value changes, the widget automatically updates itself to show the new value. How the string is displayed in the widget depends on the particular widget and may be decided by other options like
-anchoror-justify. not me being obsessed with a live-updating variable π«Ά
- Specifies the name of a global variable. The value of that variable is a text string to be displayed inside the widget; if the variable's value changes, the widget automatically updates itself to show the new value. How the string is displayed in the widget depends on the particular widget and may be decided by other options like
-troughcolorβ Command-Line Name:-troughcolorΒ· Database Name:troughColorΒ· Database Class:Background- Specifies the color to use for the rectangular trough areas in widgets like scrollbars and scales. This option is ignored for scrollbars on Windows (the native widget doesn't recognize this option). π
-underlineβ Command-Line Name:-underlineΒ· Database Name:underlineΒ· Database Class:Underline- Specifies the integer index of a character to underline in the widget. This option is what the default bindings use to implement keyboard traversal for menu buttons and menu entries.
0corresponds to the first character of the text displayed in the widget,1to the next character, and so on.endcorresponds to the last character,end-1to the one before last, and so on. π
- Specifies the integer index of a character to underline in the widget. This option is what the default bindings use to implement keyboard traversal for menu buttons and menu entries.
-wraplengthβ Command-Line Name:-wraplengthΒ· Database Name:wrapLengthΒ· Database Class:WrapLength- For widgets that can do word-wrapping, this option specifies the maximum line length. Lines that would exceed that length get wrapped onto the next line, so no line ends up longer than the length you specified. The value may be given in any of the standard forms for screen distances. If the value is negative or zero then no wrapping happens at all: lines break only at newline characters in the text. π
-xscrollcommandβ Command-Line Name:-xscrollcommandΒ· Database Name:xScrollCommandΒ· Database Class:ScrollCommand
...and that's exactly where this part hands things off π
Specifies the prefix for a command used to talk to horizontal scrollbars. π
So here's the vibe: whenever the view in the widget's window changes β or literally anything else happens that could change what a scrollbar is showing, like when the total size of the widget's contents changes β the widget rolls up a Tcl command by gluing the scroll command together with two numbers. β¨
Each of those numbers is a fraction between 0 and 1, and it tells you a position in the document:
0= the very beginning of the document πΌ1= the end, periodt π.333= a position one third of the way through the document- and so on, you get the math bestie π
The first fraction is the first information in the document that's visible in the window, and the second fraction is the information just after the last portion that's visible. Then that command gets handed off to the Tcl interpreter to be executed. π
Typically the -xscrollcommand option is the path name of a scrollbar widget followed by set, e.g. .x.scrollbar set β and doing that means the scrollbar gets updated whenever the view in the window changes. Iconic behaviour honestly. π¦
If this option isn't specified, then no command will be executed. Yeah. Nothing happens. The scrollbar's just gonna sit there. π
π«Ά -yscrollcommand
- Command-Line Name:
-yscrollcommand - Database Name:
yScrollCommand - Database Class:
ScrollCommand
Specifies the prefix for a command used to communicate with vertical scrollbars. Same treatment as the -xscrollcommand option in every way, except this one is for vertical scrollbars and it's provided by widgets that support vertical scrolling. π₯
For the full details on how this option gets used, go read the description of -xscrollcommand β it's all there, no cap. π
π SEE ALSO π
colorscursorsfont
β KEYWORDS β
classnamestandard optionswitch
and that's a wrap on options(3tk) bestie!! πβ¨ this whole thing is from Tk 4.4, dated way back in the day, and it lives under the options section β go forth and configure your widgets, you absolute main character ππ
π¦ 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