Node:toplevel, Next:, Previous:frame, Up:Widget creation



toplevel

A toplevel widget is a new toplevel window. It is a container widget inside which other widgets are displayed. The root toplevel widget has path . -- i.e. dot on its own. Subsequent toplevel widgets must have a name which is lower down the path tree just like any other widget.

An example of creating a toplevel widget is:

     toplevel .t
     

All the widgets displayed inside .t must also have .t as the root of their path. For example, to create a button widget for display inside the .t toplevel the following would work:

     button .t.b -text "Inside 't'"
     

(Attributes, such as size and title, of toplevel widgets can be changed through the wm command, which we will not cover in this tutorial. The reader is referred to the Tk manual.)