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

NAME

8       wm - Communicate with window manager
9

SYNOPSIS

11       wm option window ?args?
12_________________________________________________________________
13
14

DESCRIPTION

16       The  wm  command  is  used to interact with window managers in order to
17       control such things as the title for a window,  its  geometry,  or  the
18       increments  in  terms  of  which it may be resized.  The wm command can
19       take any of a number of different forms, depending on the option  argu‐
20       ment.   All  of the forms expect at least one additional argument, win‐
21       dow, which must be the path name of a top-level window.
22
23       The legal forms for the wm command are:
24
25       wm aspect window ?minNumer minDenom maxNumer maxDenom?
26              If minNumer, minDenom, maxNumer, and maxDenom are all specified,
27              then  they  will  be passed to the window manager and the window
28              manager should use them to enforce a range of acceptable  aspect
29              ratios  for  window.   The aspect ratio of window (width/length)
30              will be constrained to lie between minNumer/minDenom and  maxNu‐
31              mer/maxDenom.   If  minNumer  etc.  are  all  specified as empty
32              strings,  then  any  existing  aspect  ratio  restrictions   are
33              removed.   If  minNumer  etc.  are  specified,  then the command
34              returns an empty string.  Otherwise, it returns a Tcl list  con‐
35              taining four elements, which are the current values of minNumer,
36              minDenom, maxNumer, and maxDenom (if no aspect restrictions  are
37              in effect, then an empty string is returned).                    │
38
39       wm attributes window                                                    │
40
41       wm attributes window ?option?                                           │
42
43       wm attributes window ?option value option value...?                     │
44              This  subcommand  returns  or  sets platform specific attributes │
45              associated with a window. The first form returns a list  of  the │
46              platform  specific  flags  and  their  values.  The  second form │
47              returns the value for the specific option. The third  form  sets │
48              one or more of the values. The values are as follows:            │
49
50              On  Windows,  -disabled  gets or sets whether the window is in a │
51              disabled state. -toolwindow gets or sets the style of the window │
52              to  toolwindow  (as  defined in the MSDN). -topmost gets or sets │
53              whether this is a topmost window (displays above all other  win‐ │
54              dows).    -alpha  sets  the  alpha  transparency  level  of  the │
55              toplevel.  It accepts a value from 0.0  (fully  transparent)  to │
56              1.0  (opaque).   Values  outside that range will be constrained. │
57              This is supported on Windows 2000/XP+.  Where not supported, the │
58              -alpha value remains at 1.0.                                     │
59
60              On  Mac  OS  X, -modified gets or sets the modification state of │
61              the window (determines whether the window close widget  contains │
62              the  modification  indicator and whether the proxy icon is drag‐ │
63              gable).  -titlepath gets or sets the path of the file referenced │
64              as  the  window  proxy icon (which can be dragged and dropped in │
65              lieu of the file's finder icon). -alpha sets  the  alpha  trans‐ │
66              parency  level of the window, it accepts a value from 0.0 (fully │
67              transparent) to 1.0 (opaque), values outside that range will  be │
68              constrained.                                                     │
69
70              On Unix, there are currently no special attribute values.        │
71
72       wm client window ?name?
73              If  name is specified, this command stores name (which should be
74              the name of the host on which the application is  executing)  in
75              window's  WM_CLIENT_MACHINE  property for use by the window man‐
76              ager or session manager.  The command returns an empty string in
77              this  case.   If  name  isn't specified, the command returns the
78              last name set in a wm client command for  window.   If  name  is
79              specified   as   an   empty  string,  the  command  deletes  the
80              WM_CLIENT_MACHINE property from window.
81
82       wm colormapwindows window ?windowList?
83              This command is used to manipulate the WM_COLORMAP_WINDOWS prop‐
84              erty,  which  provides  information to the window managers about
85              windows that have private colormaps.  If windowList isn't speci‐
86              fied, the command returns a list whose elements are the names of
87              the windows in the WM_COLORMAP_WINDOWS property.  If  windowList
88              is  specified,  it consists of a list of window path names;  the
89              command overwrites the  WM_COLORMAP_WINDOWS  property  with  the
90              given windows and returns an empty string.  The WM_COLORMAP_WIN‐
91              DOWS property should normally contain a  list  of  the  internal
92              windows within window whose colormaps differ from their parents.
93              The order of the windows in the property  indicates  a  priority
94              order:  the  window manager will attempt to install as many col‐
95              ormaps as possible from the head of this list when  window  gets
96              the colormap focus.  If window is not included among the windows
97              in windowList, Tk implicitly adds it at the end of  the  WM_COL‐
98              ORMAP_WINDOWS property, so that its colormap is lowest in prior‐
99              ity.  If wm colormapwindows is not invoked,  Tk  will  automati‐
100              cally  set  the  property  for  each top-level window to all the
101              internal windows whose colormaps differ from their parents, fol‐
102              lowed  by  the top-level itself;  the order of the internal win‐
103              dows is undefined.  See the ICCCM documentation for more  infor‐
104              mation on the WM_COLORMAP_WINDOWS property.
105
106       wm command window ?value?
107              If  value  is  specified,  this command stores value in window's
108              WM_COMMAND property for use by the  window  manager  or  session
109              manager  and  returns  an  empty string.  Value must have proper
110              list structure;  the elements should contain the  words  of  the
111              command  used  to invoke the application.  If value isn't speci‐
112              fied then the command returns the last value set in a wm command
113              command  for  window.  If value is specified as an empty string,
114              the command deletes the WM_COMMAND property from window.
115
116       wm deiconify window
117              Arrange for window to be  displayed  in  normal  (non-iconified)
118              form.   This  is  done by mapping the window.  If the window has
119              never been mapped then this command will not map the window, but
120              it  will  ensure that when the window is first mapped it will be
121              displayed in de-iconified form.  On Windows, a deiconified  win‐
122              dow  will also be raised and be given the focus (made the active
123              window).  Returns an empty string.
124
125       wm focusmodel window ?active|passive?
126              If active or passive is supplied as an optional argument to  the
127              command,  then it specifies the focus model for window.  In this
128              case the command returns an  empty  string.   If  no  additional
129              argument is supplied, then the command returns the current focus
130              model for window.  An active focus model means that window  will
131              claim  the  input  focus  for itself or its descendants, even at
132              times when the focus is currently  in  some  other  application.
133              Passive means that window will never claim the focus for itself:
134              the window manager should give the focus to window at  appropri‐
135              ate  times.  However, once the focus has been given to window or
136              one of its descendants, the application may re-assign the  focus
137              among  window's  descendants.   The focus model defaults to pas‐
138              sive, and Tk's focus command assumes a passive model  of  focus‐
139              ing.
140
141       wm frame window
142              If window has been reparented by the window manager into a deco‐ │
143              rative frame, the command returns the platform  specific  window │
144              identifier  for  the  outermost  frame that contains window (the │
145              window whose parent is the root or  virtual  root).   If  window
146              hasn't  been  reparented  by the window manager then the command │
147              returns the platform specific window identifier for window.
148
149       wm geometry window ?newGeometry?
150              If newGeometry is specified, then  the  geometry  of  window  is
151              changed  and an empty string is returned.  Otherwise the current
152              geometry for window is returned (this is the most recent  geome‐
153              try specified either by manual resizing or in a wm geometry com‐
154              mand).  NewGeometry has the form =widthxheight±x±y, where any of
155              =,  widthxheight,  or ±x±y may be omitted.  Width and height are
156              positive integers specifying the desired dimensions  of  window.
157              If  window  is  gridded  (see GRIDDED GEOMETRY MANAGEMENT below)
158              then the dimensions are specified in grid units;  otherwise they
159              are specified in pixel units.  X and y specify the desired loca‐
160              tion of window on the screen, in pixels.  If x is preceded by +,
161              it  specifies  the number of pixels between the left edge of the
162              screen and the left edge of window's border;  if preceded  by  -
163              then  x specifies the number of pixels between the right edge of
164              the screen and the right edge of window's border.  If y is  pre‐
165              ceded  by  +  then it specifies the number of pixels between the
166              top of the screen and the top of window's border;  if y is  pre‐
167              ceded  by  -  then it specifies the number of pixels between the
168              bottom of window's border and the bottom of the screen.  If new‐
169              Geometry is specified as an empty string then any existing user-
170              specified geometry for window is cancelled, and the window  will
171              revert to the size requested internally by its widgets.
172
173       wm grid window ?baseWidth baseHeight widthInc heightInc?
174              This command indicates that window is to be managed as a gridded
175              window.  It also specifies the relationship between  grid  units
176              and pixel units.  BaseWidth and baseHeight specify the number of
177              grid units  corresponding  to  the  pixel  dimensions  requested
178              internally  by  window  using  Tk_GeometryRequest.  WidthInc and
179              heightInc specify the number of pixels in  each  horizontal  and
180              vertical  grid  unit.   These  four  values determine a range of
181              acceptable sizes for window, corresponding to grid-based  widths
182              and  heights  that are non-negative integers.  Tk will pass this
183              information to the window manager;  during manual resizing,  the
184              window  manager  will restrict the window's size to one of these
185              acceptable sizes.  Furthermore, during manual resizing the  win‐
186              dow  manager  will display the window's current size in terms of
187              grid units rather than pixels.  If baseWidth etc. are all speci‐
188              fied  as empty strings, then window will no longer be managed as
189              a gridded window.  If baseWidth  etc.  are  specified  then  the
190              return  value is an empty string.  Otherwise the return value is
191              a Tcl list containing four elements corresponding to the current
192              baseWidth,  baseHeight,  widthInc,  and heightInc;  if window is
193              not currently gridded, then an empty string is returned.   Note:
194              this  command should not be needed very often, since the Tk_Set‐
195              Grid library procedure and the  setGrid  option  provide  easier
196              access to the same functionality.
197
198       wm group window ?pathName?
199              If  pathName is specified, it gives the path name for the leader
200              of a group of related windows.  The window manager may use  this
201              information, for example, to unmap all of the windows in a group
202              when the group's leader is iconified.  PathName may be specified
203              as  an empty string to remove window from any group association.
204              If pathName is specified  then  the  command  returns  an  empty
205              string;   otherwise it returns the path name of window's current
206              group leader, or an empty string if window  isn't  part  of  any
207              group.
208
209       wm iconbitmap window ?bitmap?
210              If  bitmap  is specified, then it names a bitmap in the standard
211              forms accepted by Tk (see  the  Tk_GetBitmap  manual  entry  for
212              details).   This  bitmap  is  passed to the window manager to be
213              displayed in window's icon, and the  command  returns  an  empty
214              string.   If  an  empty string is specified for bitmap, then any
215              current icon bitmap is cancelled for window.  If bitmap is spec‐
216              ified  then  the  command returns an empty string.  Otherwise it
217              returns the name of the current icon bitmap associated with win‐
218              dow,  or  an  empty string if window has no icon bitmap.  On the
219              Windows operating system, an additional flag  is  supported:  wm
220              iconbitmap  window  ?-default? ?image?.  If the -default flag is
221              given, the icon is applied to all toplevel windows (existing and
222              future)  to  which  no other specific icon has yet been applied.
223              In addition to bitmap image types, a full path specification  to
224              any  file  which  contains a valid Windows icon is also accepted
225              (usually .ico or .icr files), or any file for  which  the  shell
226              has  assigned an icon.  Tcl will first test if the file contains
227              an icon, then if it has an assigned icon, and finally,  if  that
228              fails, test for a bitmap.
229
230       wm iconify window
231              Arrange  for  window to be iconified.  It window hasn't yet been
232              mapped for the first time, this command will arrange for  it  to
233              appear in the iconified state when it is eventually mapped.
234
235       wm iconmask window ?bitmap?
236              If  bitmap  is specified, then it names a bitmap in the standard
237              forms accepted by Tk (see  the  Tk_GetBitmap  manual  entry  for
238              details).   This  bitmap  is  passed to the window manager to be
239              used as a mask in conjunction with the iconbitmap option:  where
240              the  mask  has  zeroes  no icon will be displayed;  where it has
241              ones, the bits from the icon bitmap will be  displayed.   If  an
242              empty  string is specified for bitmap then any current icon mask
243              is cancelled for window (this is equivalent to specifying a bit‐
244              map  of  all  ones).   If  bitmap  is specified then the command
245              returns an empty string.  Otherwise it returns the name  of  the
246              current  icon mask associated with window, or an empty string if
247              no mask is in effect.
248
249       wm iconname window ?newName?
250              If newName is specified, then it is passed to  the  window  man‐
251              ager;  the window manager should display newName inside the icon
252              associated with  window.   In  this  case  an  empty  string  is
253              returned as result.  If newName isn't specified then the command
254              returns the current icon name for window, or an empty string  if
255              no icon name has been specified (in this case the window manager
256              will normally display the window's title, as specified with  the
257              wm title command).
258
259       wm iconposition window ?x y?
260              If  x and y are specified, they are passed to the window manager
261              as a hint about where to position the icon for window.  In  this
262              case  an  empty string is returned.  If x and y are specified as
263              empty strings then any existing icon position hint is cancelled.
264              If  neither x nor y is specified, then the command returns a Tcl
265              list containing two values, which are the current icon  position
266              hints  (if  no  hints  are  in  effect  then  an empty string is
267              returned).
268
269       wm iconwindow window ?pathName?
270              If pathName is specified, it is the path name for  a  window  to
271              use  as  icon for window: when window is iconified then pathName
272              will be mapped to serve as icon, and when window is de-iconified
273              then  pathName will be unmapped again.  If pathName is specified
274              as an empty string then any existing icon window association for
275              window will be cancelled.  If the pathName argument is specified
276              then an empty string is returned.  Otherwise the command returns
277              the path name of the current icon window for window, or an empty
278              string if there is no icon window currently specified  for  win‐
279              dow.   Button press events are disabled for window as long as it
280              is an icon window;  this is needed in order to allow window man‐
281              agers  to  ``own''  those events.  Note: not all window managers
282              support the notion of an icon window.
283
284       wm maxsize window ?width height?
285              If width and height are specified, they give the maximum permis‐
286              sible dimensions for window.  For gridded windows the dimensions
287              are specified in grid units;  otherwise they  are  specified  in
288              pixel  units.   The  window  manager  will restrict the window's
289              dimensions to be less than or equal to  width  and  height.   If
290              width  and  height  are  specified,  then the command returns an
291              empty string.  Otherwise it returns a Tcl  list  with  two  ele‐
292              ments,  which  are  the  maximum  width  and height currently in
293              effect.  The maximum size defaults to the size  of  the  screen.
294              See  the sections on geometry management below for more informa‐
295              tion.
296
297       wm minsize window ?width height?
298              If width and height are specified, they give the minimum permis‐
299              sible dimensions for window.  For gridded windows the dimensions
300              are specified in grid units;  otherwise they  are  specified  in
301              pixel  units.   The  window  manager  will restrict the window's
302              dimensions to be greater than or equal to width and height.   If
303              width  and  height  are  specified,  then the command returns an
304              empty string.  Otherwise it returns a Tcl  list  with  two  ele‐
305              ments,  which  are  the  minimum  width  and height currently in
306              effect.  The minimum size defaults to one pixel in  each  dimen‐
307              sion.   See  the  sections on geometry management below for more
308              information.
309
310       wm overrideredirect window ?boolean?
311              If boolean is specified, it must have a proper boolean form  and
312              the  override-redirect flag for window is set to that value.  If
313              boolean is not specified then 1 or 0  is  returned  to  indicate
314              whether  or  not the override-redirect flag is currently set for
315              window.  Setting the override-redirect flag for a window  causes
316              it  to  be  ignored  by the window manager;  among other things,
317              this means that the window will not be reparented from the  root
318              window  into a decorative frame and the user will not be able to
319              manipulate the window using the  normal  window  manager  mecha‐
320              nisms.
321
322       wm positionfrom window ?who?
323              If  who  is  specified, it must be either program or user, or an
324              abbreviation of one of these two.  It indicates whether window's
325              current  position  was  requested by the program or by the user.
326              Many window managers ignore program-requested initial  positions
327              and  ask  the  user to manually position the window;  if user is
328              specified then the window manager should position the window  at
329              the  given place without asking the user for assistance.  If who
330              is specified as an  empty  string,  then  the  current  position
331              source  is  cancelled.   If  who  is specified, then the command
332              returns an empty string.  Otherwise it returns user  or  program
333              to  indicate  the source of the window's current position, or an
334              empty string if no source has been specified yet.   Most  window
335              managers  interpret  ``no source'' as equivalent to program.  Tk
336              will automatically set the position source to  user  when  a  wm
337              geometry  command  is  invoked,  unless  the source has been set
338              explicitly to program.
339
340       wm protocol window ?name? ?command?
341              This command is used to manage window manager protocols such  as
342              WM_DELETE_WINDOW.   Name is the name of an atom corresponding to
343              a  window  manager  protocol,  such   as   WM_DELETE_WINDOW   or
344              WM_SAVE_YOURSELF or WM_TAKE_FOCUS.  If both name and command are
345              specified, then command is associated with the  protocol  speci‐
346              fied by name.  Name will be added to window's WM_PROTOCOLS prop‐
347              erty to tell the window manager that the application has a  pro‐
348              tocol  handler  for  name,  and  command  will be invoked in the
349              future whenever the window manager sends a message to the client
350              for  that  protocol.   In this case the command returns an empty
351              string.  If name is specified but command isn't, then  the  cur‐
352              rent  command  for name is returned, or an empty string if there
353              is no handler defined for name.  If command is specified  as  an
354              empty string then the current handler for name is deleted and it
355              is removed from the WM_PROTOCOLS property on window;   an  empty
356              string  is  returned.   Lastly,  if  neither name nor command is
357              specified, the command returns a list of all the  protocols  for
358              which handlers are currently defined for window.
359
360              Tk  always defines a protocol handler for WM_DELETE_WINDOW, even
361              if  you  haven't  asked  for  one  with  wm  protocol.    If   a
362              WM_DELETE_WINDOW message arrives when you haven't defined a han‐
363              dler, then Tk handles the message by destroying the  window  for
364              which it was received.
365
366       wm resizable window ?width height?
367              This  command controls whether or not the user may interactively
368              resize a top-level window.  If width and height  are  specified,
369              they  are  boolean  values  that determine whether the width and
370              height of window may be modified by the user.  In this case  the
371              command  returns an empty string.  If width and height are omit‐
372              ted then the command returns a list with two 0/1  elements  that
373              indicate  whether  the  width and height of window are currently
374              resizable.  By default, windows are  resizable  in  both  dimen‐
375              sions.   If resizing is disabled, then the window's size will be
376              the size from the most recent interactive resize or wm  geometry
377              command.   If there has been no such operation then the window's
378              natural size will be used.
379
380       wm sizefrom window ?who?
381              If who is specified, it must be either program or  user,  or  an
382              abbreviation of one of these two.  It indicates whether window's
383              current size was requested by the program or by the user.   Some
384              window  managers ignore program-requested sizes and ask the user
385              to manually size the window;  if user is specified then the win‐
386              dow  manager  should  give the window its specified size without
387              asking the user for assistance.  If who is specified as an empty
388              string,  then  the  current size source is cancelled.  If who is
389              specified, then the command returns an empty string.   Otherwise
390              it returns user or window to indicate the source of the window's
391              current size, or an empty string if no source has been specified
392              yet.  Most window managers interpret ``no source'' as equivalent
393              to program.
394
395       wm stackorder window ?isabove|isbelow window?
396              The stackorder command returns a list  of  toplevel  windows  in
397              stacking  order,  from lowest to highest. When a single toplevel
398              window is passed, the returned list recursively includes all  of
399              the  window's  children that are toplevels. Only those toplevels
400              that are currently mapped  to  the  screen  are  returned.   The
401              stackorder command can also be used to determine if one toplevel
402              is positioned above or below a second toplevel.  When two window
403              arguments  separated  by either isabove or isbelow are passed, a
404              boolean result indicates whether or not the first window is cur‐
405              rently above or below the second window in the stacking order.
406
407       wm state window ?newstate?
408              If  newstate  is  specified,  the  window will be set to the new
409              state, otherwise it returns the current state of window:  either
410              normal,  iconic, withdrawn, icon, or (Windows and Mac OS X only)
411              zoomed.  The difference between iconic and icon is  that  iconic
412              refers  to  a  window that has been iconified (e.g., with the wm
413              iconify command) while icon refers to a window whose  only  pur‐
414              pose  is  to serve as the icon for some other window (via the wm
415              iconwindow command).  The icon state cannot be set.
416
417       wm title window ?string?
418              If string is specified, then it will be  passed  to  the  window
419              manager  for  use  as  the  title for window (the window manager
420              should display this string in window's title bar).  In this case
421              the  command returns an empty string.  If string isn't specified
422              then the command returns the current title for the window.   The
423              title for a window defaults to its name.
424
425       wm transient window ?master?
426              If master is specified, then the window manager is informed that
427              window is a transient window (e.g. pull-down  menu)  working  on
428              behalf  of master (where master is the path name for a top-level
429              window).  If master is specified as an empty string then  window
430              is  marked  as not being a transient window any more.  Otherwise
431              the command returns the path name of window's current master, or
432              an empty string if window isn't currently a transient window.  A
433              transient window will mirror state changes  in  the  master  and
434              inherit  the state of the master when initially mapped. It is an
435              error to attempt to make a window a transient of itself.
436
437       wm withdraw window
438              Arranges for window to  be  withdrawn  from  the  screen.   This
439              causes the window to be unmapped and forgotten about by the win‐
440              dow manager.  If the window has never  been  mapped,  then  this
441              command  causes  the window to be mapped in the withdrawn state.
442              Not all window managers appear to know  how  to  handle  windows
443              that  are  mapped  in  the  withdrawn state.  Note: it sometimes
444              seems to be necessary to withdraw a window and  then  re-map  it
445              (e.g.  with  wm  deiconify)  to  get some window managers to pay
446              attention to changes in window attributes such as group.
447

GEOMETRY MANAGEMENT

449       By default a top-level window appears on  the  screen  in  its  natural
450       size,  which is the one determined internally by its widgets and geome‐
451       try managers.  If the natural size of a top-level window changes,  then
452       the  window's size changes to match.  A top-level window can be given a
453       size other than its natural size in two  ways.   First,  the  user  can
454       resize  the window manually using the facilities of the window manager,
455       such as resize handles.  Second, the application can request a particu‐
456       lar  size  for a top-level window using the wm geometry command.  These
457       two cases are handled identically by Tk;  in either case, the requested
458       size overrides the natural size.  You can return the window to its nat‐
459       ural by invoking wm geometry with an empty geometry string.
460
461       Normally a top-level window can have any size from one  pixel  in  each
462       dimension  up  to  the size of its screen.  However, you can use the wm
463       minsize and wm maxsize commands to limit the range of allowable  sizes.
464       The  range  set  by  wm  minsize and wm maxsize applies to all forms of
465       resizing, including the window's natural size as well as manual resizes
466       and the wm geometry command.  You can also use the command wm resizable
467       to completely disable interactive resizing in one or both dimensions.
468

GRIDDED GEOMETRY MANAGEMENT

470       Gridded geometry management occurs when one of the widgets of an appli‐
471       cation  supports a range of useful sizes.  This occurs, for example, in
472       a text editor where the scrollbars, menus,  and  other  adornments  are
473       fixed  in  size  but the edit widget can support any number of lines of
474       text or characters per line.  In this case, it is usually desirable  to
475       let the user specify the number of lines or characters-per-line, either
476       with the wm geometry command or by interactively resizing  the  window.
477       In the case of text, and in other interesting cases also, only discrete
478       sizes of the window make sense, such as integral numbers of  lines  and
479       characters-per-line;  arbitrary pixel sizes are not useful.
480
481       Gridded  geometry management provides support for this kind of applica‐
482       tion.  Tk (and the window manager) assume that there is a grid of  some
483       sort  within the application and that the application should be resized
484       in terms of grid units rather than pixels.  Gridded geometry management
485       is typically invoked by turning on the setGrid option for a widget;  it
486       can also be invoked with the wm grid command or by calling  Tk_SetGrid.
487       In each of these approaches the particular widget (or sometimes code in
488       the application as a whole) specifies the relationship between integral
489       grid  sizes  for  the window and pixel sizes.  To return to non-gridded
490       geometry management, invoke wm grid with empty argument strings.
491
492       When gridded geometry management is enabled  then  all  the  dimensions
493       specified  in  wm  minsize,  wm  maxsize,  and wm geometry commands are
494       treated as grid units rather than pixel units.  Interactive resizing is
495       also carried out in even numbers of grid units rather than pixels.
496

BUGS

498       Most existing window managers appear to have bugs that affect the oper‐
499       ation of the wm command.  For example, some changes won't  take  effect
500       if  the window is already active:  the window will have to be withdrawn
501       and de-iconified in order to make the change happen.
502

EXAMPLES

504       A fixed-size window that says that it is fixed-size too:
505              toplevel .fixed
506              wm title     .fixed "Fixed-size Window"
507              wm resizable .fixed 0 0
508
509       A simple dialog-like window, centred on the screen:
510              # Create and arrange the dialog contents.
511              toplevel .msg
512              label  .msg.l  -text "This is a very simple dialog demo."
513              button .msg.ok -text OK -default active -command {destroy .msg}
514              pack .msg.ok -side bottom -fill x
515              pack .msg.l  -expand 1    -fill both
516
517              # Now set the widget up as a centred dialog.
518
519              # But first, we need the geometry managers to finish setting
520              # up the interior of the dialog, for which we need to run the
521              # event loop with the widget hidden completely...
522              wm withdraw .msg
523              update
524              set x [expr {([winfo screenwidth .]-[winfo width .msg])/2}]
525              set y [expr {([winfo screenheight .]-[winfo height .msg])/2}]
526              wm geometry  .msg +$x+$y
527              wm transient .msg .
528              wm title     .msg "Dialog demo"
529              wm deiconify .msg
530
531

SEE ALSO

533       toplevel(n), winfo(n)
534
535

KEYWORDS

537       aspect ratio, deiconify, focus  model,  geometry,  grid,  group,  icon,
538       iconify,  increments,  position,  size, title, top-level window, units,
539       window manager
540
541
542
543Tk                                    8.4                                wm(n)
Impressum