5.10 Toplevel Widgets and Window Manager Commands

To manipulate toplevel widgets which are managed by the window manager similar to how other widgets are managed by a geometry manager, Tcl/Tk provides for the wm command.

For example, by

{Tk.send wm(iconify T)}

the toplevel widget T is iconified whereas by

{Tk.send wm(deiconify T)}

it is deiconified. For more information see wm.

Two important forms of the wm command are supported such that they can be given as options to the tkInit method of the Tk.toplevel class.

titled toplevel

For example

W={New Tk.toplevel tkInit(title:'Something different')}

creates a toplevel widget with the title Something different.

withdrawn toplevels

Sometimes it is important to create a toplevel widget in a withdrawn state: the toplevel widget does not appear on the screen. This can be used to first create all widgets to be contained in the toplevel widget, invoke a geometry manager for them, and only then make the toplevel widget appear on the screen. A toplevel widget can be created in withdrawn state by

W={New Tk.toplevel tkInit(withdraw:true)}

To make the toplevel widget appear, the window manager command

{Tk.send wm(deiconify W)}

can be used.

Reference information on the window manager command can be found in wm.


Christian Schulte
Version 1.4.0 (20080702)