1options(n)                   Tk Built-In Commands                   options(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       options - Standard options supported by widgets
9_________________________________________________________________
10
11

DESCRIPTION

13       This  manual entry describes the common configuration options supported
14       by widgets in the Tk toolkit.  Every widget does not  necessarily  sup‐
15       port  every option (see the manual entries for individual widgets for a
16       list of the standard options supported by that widget), but if a widget
17       does  support  an  option  with one of the names listed below, then the
18       option has exactly the effect described below.
19
20       In the descriptions below, ``Command-Line Name'' refers to  the  switch
21       used in class commands and configure widget commands to set this value.
22       For example, if an option's  command-line  switch  is  -foreground  and
23       there exists a widget .a.b.c, then the command
24              .a.b.c  configure  -foreground black
25       may  be  used  to  specify the value black for the option in the widget
26       .a.b.c.  Command-line switches may  be  abbreviated,  as  long  as  the
27       abbreviation  is unambiguous.  ``Database Name'' refers to the option's
28       name in the option database (e.g.  in  .Xdefaults  files).   ``Database
29       Class''  refers  to  the  option's  class value in the option database.
30       [-activebackground activeBackground] Specifies background color to  use
31       when  drawing  active  elements.   An element (a widget or portion of a
32       widget) is active if the mouse cursor is positioned  over  the  element
33       and pressing a mouse button will cause some action to occur.  If strict
34       Motif compliance has been requested by setting the tk_strictMotif vari‐
35       able,  this  option  will  normally  be ignored;  the normal background
36       color will be used instead.  For some elements on Windows and Macintosh │
37       systems,  the  active  color  will only be used while mouse button 1 is │
38       pressed over the element.  [-activeborderwidth activeBorderWidth] Spec‐
39       ifies a non-negative value indicating the width of the 3-D border drawn
40       around active elements.  See above for definition of  active  elements.
41       The  value  may have any of the forms acceptable to Tk_GetPixels.  This
42       option is typically only available in widgets displaying more than  one
43       element  at  a  time  (e.g.  menus  but  not  buttons).   [-activefore‐
44       ground activeForeground] Specifies foreground color to use when drawing
45       active   elements.   See  above  for  definition  of  active  elements.
46       [-anchor anchor] Specifies how the information in a widget  (e.g.  text
47       or a bitmap) is to be displayed in the widget.  Must be one of the val‐
48       ues n, ne, e, se, s, sw, w, nw, or center.  For example, nw means  dis‐
49       play  the  information such that its top-left corner is at the top-left
50       corner of the widget.  [-background or  -bg background]  Specifies  the
51       normal  background  color  to  use  when displaying the widget.  [-bit‐
52       map bitmap] Specifies a bitmap to display in the widget, in any of  the
53       forms acceptable to Tk_GetBitmap.  The exact way in which the bitmap is
54       displayed may be affected by other options such as anchor  or  justify.
55       Typically,  if this option is specified then it overrides other options
56       that specify a textual value to display in the widget but this is  con‐
57       trolled  by  the  compound option; the bitmap option may be reset to an
58       empty string to re-enable a text display.  In widgets that support both
59       bitmap  and  image options, image will usually override bitmap.  [-bor‐
60       derwidth or -bd borderWidth] Specifies a non-negative value  indicating
61       the  width  of  the 3-D border to draw around the outside of the widget
62       (if such a border is being drawn;  the relief option  typically  deter‐
63       mines  this).   The  value may also be used when drawing 3-D effects in
64       the interior of the widget.  The  value  may  have  any  of  the  forms
65       acceptable  to Tk_GetPixels.  [-cursor cursor] Specifies the mouse cur‐
66       sor to be used for the widget.  The value may have  any  of  the  forms
67       acceptable to Tk_GetCursor.  [-compound compound] Specifies if the wid‐ │
68       get should display text and bitmaps/images at the same time, and if so, │
69       where  the bitmap/image should be placed relative to the text.  Must be │
70       one of the values none, bottom, top, left, right, or center.  For exam‐ │
71       ple, the (default) value none specifies that the bitmap or image should │
72       (if defined) be displayed instead of the text, the value left specifies │
73       that  the  bitmap or image should be displayed to the left of the text, │
74       and the value center specifies that the bitmap or image should be  dis‐ │
75       played  on  top  of the text.  [-disabledforeground disabledForeground]
76       Specifies foreground color to use when drawing a disabled element.   If
77       the option is specified as an empty string (which is typically the case
78       on monochrome displays), disabled elements are drawn  with  the  normal
79       foreground  color  but  they are dimmed by drawing them with a stippled
80       fill pattern.  [-exportselection exportSelection] Specifies whether  or
81       not  a  selection  in  the  widget should also be the X selection.  The
82       value may have any of the forms accepted  by  Tcl_GetBoolean,  such  as
83       true,  false,  0,  1,  yes,  or no.  If the selection is exported, then
84       selecting in the widget deselects the current  X  selection,  selecting
85       outside  the widget deselects any widget selection, and the widget will
86       respond to selection retrieval requests when it has a  selection.   The
87       default  is  usually  for  widgets  to export selections.  [-font font]
88       Specifies the font to use when drawing text  inside  the  widget.   The
89       value  may  have any of the forms accepted by Tk_GetFont.  [-foreground
90       or -fg foreground] Specifies the normal foreground color  to  use  when
91       displaying   the   widget.   [-highlightbackground highlightBackground]
92       Specifies the color to display in the traversal highlight  region  when
93       the  widget does not have the input focus.  [-highlightcolor highlight‐
94       Color] Specifies the color to use for the traversal highlight rectangle
95       that  is  drawn around the widget when it has the input focus.  [-high‐
96       lightthickness highlightThickness] Specifies a non-negative value indi‐
97       cating  the width of the highlight rectangle to draw around the outside
98       of the widget when it has the input focus.  The value may have  any  of
99       the  forms  acceptable to Tk_GetPixels.  If the value is zero, no focus
100       highlight is drawn around  the  widget.   [-image image]  Specifies  an
101       image  to  display in the widget, which must have been created with the
102       image create command.  Typically, if the image option is specified then
103       it  overrides  other  options that specify a bitmap or textual value to
104       display in the widget,  though  this  is  controlled  by  the  compound
105       option; the image option may be reset to an empty string to re-enable a
106       bitmap or text display.  [-insertbackground insertBackground] Specifies
107       the  color  to  use  as background in the area covered by the insertion
108       cursor.  This color will normally override either the normal background
109       for  the  widget  (or  the selection background if the insertion cursor
110       happens to fall in the  selection).   [-insertborderwidth insertBorder‐
111       Width]  Specifies  a non-negative value indicating the width of the 3-D
112       border to draw around the insertion cursor.  The value may have any  of
113       the  forms  acceptable to Tk_GetPixels.  [-insertofftime insertOffTime]
114       Specifies a non-negative integer value indicating the  number  of  mil‐
115       liseconds  the  insertion  cursor  should  remain ``off'' in each blink
116       cycle.  If this option is zero then the cursor doesn't blink:  it is on
117       all  the  time.   [-insertontime insertOnTime] Specifies a non-negative
118       integer value indicating the number of milliseconds the insertion  cur‐
119       sor  should  remain  ``on''  in each blink cycle.  [-insertwidth inser‐
120       tWidth] Specifies a  value indicating the total width of the  insertion
121       cursor.   The  value may have any of the forms acceptable to Tk_GetPix‐
122       els.  If a border has been specified for the  insertion  cursor  (using
123       the  insertBorderWidth  option),  the  border  will be drawn inside the
124       width specified by the insertWidth option.   [-jump jump]  For  widgets
125       with  a  slider  that can be dragged to adjust a value, such as scroll‐
126       bars, this option determines when notifications are made about  changes
127       in  the  value.   The  option's  value  must  be  a boolean of the form
128       accepted by Tcl_GetBoolean.  If the value is false,  updates  are  made
129       continuously  as  the slider is dragged.  If the value is true, updates
130       are delayed until the mouse button is released to  end  the  drag;   at
131       that  point  a  single notification is made (the value ``jumps'' rather
132       than changing smoothly).  [-justify justify] When  there  are  multiple
133       lines  of  text  displayed  in a widget, this option determines how the
134       lines line up with each other.  Must be one of left, center, or  right.
135       Left  means  that  the lines' left edges all line up, center means that
136       the lines' centers are aligned, and right means that the  lines'  right
137       edges  line  up.   [-orient orient] For widgets that can lay themselves
138       out with either a horizontal or vertical orientation, such  as  scroll‐
139       bars,  this option specifies which orientation should be used.  Must be
140       either horizontal or vertical or  an  abbreviation  of  one  of  these.
141       [-padx padX]  Specifies  a non-negative value indicating how much extra
142       space to request for the widget in the X-direction.  The value may have
143       any  of the forms acceptable to Tk_GetPixels.  When computing how large
144       a window it needs, the widget will add this  amount  to  the  width  it
145       would normally need (as determined by the width of the things displayed
146       in the widget);  if the geometry manager can satisfy this request,  the
147       widget  will  end up with extra internal space to the left and/or right
148       of what it displays inside.  Most widgets only use this option for pad‐
149       ding text:  if they are displaying a bitmap or image, then they usually
150       ignore padding options.  [-pady padY] Specifies  a  non-negative  value
151       indicating  how  much  extra  space to request for the widget in the Y-
152       direction.  The value may have any of the forms acceptable  to  Tk_Get‐
153       Pixels.   When  computing  how large a window it needs, the widget will
154       add this amount to the height it would normally need (as determined  by
155       the  height  of  the  things displayed in the widget);  if the geometry
156       manager can satisfy this request, the widget will  end  up  with  extra
157       internal  space  above and/or below what it displays inside.  Most wid‐
158       gets only use this option for padding text:  if they are  displaying  a
159       bitmap   or   image,   then   they   usually  ignore  padding  options.
160       [-relief relief] Specifies the  3-D  effect  desired  for  the  widget.
161       Acceptable  values  are raised, sunken, flat, ridge, solid, and groove.
162       The value indicates how the interior of the widget should appear  rela‐
163       tive  to  its  exterior;  for example, raised means the interior of the
164       widget should appear to protrude from the screen, relative to the exte‐
165       rior of the widget.  [-repeatdelay repeatDelay] Specifies the number of
166       milliseconds a button or key must be held  down  before  it  begins  to
167       auto-repeat.   Used, for example, on the up- and down-arrows in scroll‐
168       bars.   [-repeatinterval repeatInterval]  Used  in   conjunction   with
169       repeatDelay:   once auto-repeat begins, this option determines the num‐
170       ber of milliseconds between  auto-repeats.   [-selectbackground select‐
171       Background]  Specifies  the  background  color  to  use when displaying
172       selected  items.   [-selectborderwidth selectBorderWidth]  Specifies  a
173       non-negative  value  indicating  the  width  of  the 3-D border to draw
174       around selected items.  The value may have any of the forms  acceptable
175       to  Tk_GetPixels.   [-selectforeground selectForeground]  Specifies the
176       foreground color to use when displaying selected items.  [-setgrid set‐
177       Grid]  Specifies  a  boolean  value that determines whether this widget
178       controls the resizing grid for its top-level window.   This  option  is
179       typically used in text widgets, where the information in the widget has
180       a natural size (the size of a character) and it  makes  sense  for  the
181       window's dimensions to be integral numbers of these units.  These natu‐
182       ral window sizes form a grid.  If the setGrid option  is  set  to  true
183       then  the  widget will communicate with the window manager so that when
184       the user interactively resizes the top-level window that  contains  the
185       widget,  the  dimensions of the window will be displayed to the user in
186       grid units and the window size will be constrained to integral  numbers
187       of  grid  units.  See the section GRIDDED GEOMETRY MANAGEMENT in the wm
188       manual  entry  for  more  details.   [-takefocus takeFocus]  Determines
189       whether  the  window accepts the focus during keyboard traversal (e.g.,
190       Tab and Shift-Tab).  Before setting the focus to a window, the  traver‐
191       sal  scripts  consult  the value of the takeFocus option.  A value of 0
192       means that the window should be skipped entirely during  keyboard  tra‐
193       versal.  1 means that the window should receive the input focus as long
194       as it is viewable (it and all of its ancestors are mapped).   An  empty
195       value for the option means that the traversal scripts make the decision
196       about whether or not to focus on the window:  the current algorithm  is
197       to  skip the window if it is disabled, if it has no key bindings, or if
198       it is not viewable.  If the value has any other form, then the  traver‐
199       sal scripts take the value, append the name of the window to it (with a
200       separator space), and evaluate the resulting string as  a  Tcl  script.
201       The script must return 0, 1, or an empty string:  a 0 or 1 value speci‐
202       fies whether the window will receive the  input  focus,  and  an  empty
203       string  results  in  the  default decision described above.  Note: this
204       interpretation of the option is defined entirely  by  the  Tcl  scripts
205       that implement traversal:  the widget implementations ignore the option
206       entirely, so you can change its meaning if you  redefine  the  keyboard
207       traversal  scripts.   [-text text]  Specifies  a string to be displayed
208       inside the widget.  The way in which the string is displayed depends on
209       the  particular  widget and may be determined by other options, such as
210       anchor or justify.  [-textvariable textVariable] Specifies the name  of
211       a variable.  The value of the variable is a text string to be displayed
212       inside the widget;  if the variable value changes then the widget  will
213       automatically update itself to reflect the new value.  The way in which
214       the string is displayed in the widget depends on the particular  widget
215       and  may  be  determined  by  other options, such as anchor or justify.
216       [-troughcolor troughColor] Specifies the color to use for the rectangu‐
217       lar trough areas in widgets such as scrollbars and scales.  This option
218       is ignored for scrollbars on Windows (native widget  doesn't  recognize
219       this  option).  [-underline underline] Specifies the integer index of a
220       character to underline in the widget.   This  option  is  used  by  the
221       default  bindings  to implement keyboard traversal for menu buttons and
222       menu entries.  0 corresponds to the first character of  the  text  dis‐
223       played   in   the   widget,  1  to  the  next  character,  and  so  on.
224       [-wraplength wrapLength] For widgets that  can  perform  word-wrapping,
225       this option specifies the maximum line length.  Lines that would exceed
226       this length are wrapped onto the next line, so that no line  is  longer
227       than  the  specified  length.  The value may be specified in any of the
228       standard forms for screen distances.  If this value  is  less  than  or
229       equal  to 0 then no wrapping is done:  lines will break only at newline
230       characters in the text.  [-xscrollcommand xScrollCommand] Specifies the
231       prefix  for  a  command used to communicate with horizontal scrollbars.
232       When the view in the widget's window changes (or whenever anything else
233       occurs  that  could change the display in a scrollbar, such as a change
234       in the total size of the widget's contents), the widget will generate a
235       Tcl  command by concatenating the scroll command and two numbers.  Each
236       of the numbers is a fraction between 0 and 1, which indicates  a  posi‐
237       tion  in  the  document.   0 indicates the beginning of the document, 1
238       indicates the end, .333 indicates a position one third the way  through
239       the document, and so on.  The first fraction indicates the first infor‐
240       mation in the document that is visible in the window,  and  the  second
241       fraction  indicates the information just after the last portion that is
242       visible.  The command is then passed to the Tcl interpreter for  execu‐
243       tion.  Typically the xScrollCommand option consists of the path name of
244       a scrollbar widget followed  by  ``set'',  e.g.  ``.x.scrollbar  set'':
245       this  will  cause  the scrollbar to be updated whenever the view in the
246       window changes.  If this option is not specified, then no command  will
247       be executed.  [-yscrollcommand yScrollCommand] Specifies the prefix for
248       a command used to communicate with vertical scrollbars.  This option is
249       treated in the same way as the xScrollCommand option, except that it is
250       used for vertical scrollbars and is provided by  widgets  that  support
251       vertical  scrolling.  See the description of xScrollCommand for details
252       on how this option is used.
253
254

SEE ALSO

256       colors, cursors, font
257
258

KEYWORDS

260       class, name, standard option, switch
261
262
263
264Tk                                    4.4                           options(n)
Impressum