1toplevel(n) Tk Built-In Commands toplevel(n)
2
3
4
5______________________________________________________________________________
6
8 toplevel - Create and manipulate 'toplevel' main and popup window wid‐
9 gets
10
12 toplevel pathName ?options?
13
15 -borderwidth -highlightcolor -pady
16 -cursor -highlightthickness -relief
17 -highlightbackground -padx -takefocus
18
19 See the options manual entry for details on the standard options.
20
22 Command-Line Name:-background
23 Database Name: background
24 Database Class: Background
25
26 This option is the same as the standard -background option ex‐
27 cept that its value may also be specified as an empty string.
28 In this case, the widget will display no background or border,
29 and no colors will be consumed from its colormap for its back‐
30 ground and border.
31
32 Command-Line Name:-class
33 Database Name: class
34 Database Class: Class
35
36 Specifies a class for the window. This class will be used when
37 querying the option database for the window's other options, and
38 it will also be used later for other purposes such as bindings.
39 Some window managers display the class name for windows in their
40 dock while some others display the window title. The -class op‐
41 tion may not be changed with the configure widget command.
42
43 Command-Line Name:-colormap
44 Database Name: colormap
45 Database Class: Colormap
46
47 Specifies a colormap to use for the window. The value may be
48 either new, in which case a new colormap is created for the win‐
49 dow and its children, or the name of another window (which must
50 be on the same screen and have the same visual as pathName), in
51 which case the new window will use the colormap from the speci‐
52 fied window. If the -colormap option is not specified, the new
53 window uses the default colormap of its screen. This option may
54 not be changed with the configure widget command.
55
56 Command-Line Name:-container
57 Database Name: container
58 Database Class: Container
59
60 The value must be a boolean. If true, it means that this window
61 will be used as a container in which some other application will
62 be embedded (for example, a Tk toplevel can be embedded using
63 the -use option). The window will support the appropriate win‐
64 dow manager protocols for things like geometry requests. The
65 window should not have any children of its own in this applica‐
66 tion. This option may not be changed with the configure widget
67 command.
68
69 Command-Line Name:-height
70 Database Name: height
71 Database Class: Height
72
73 Specifies the desired height for the window in any of the forms
74 acceptable to Tk_GetPixels. If this option is less than or
75 equal to zero then the window will not request any size at all.
76
77 Command-Line Name:-menu
78 Database Name: menu
79 Database Class: Menu
80
81 Specifies a menu widget to be used as a menubar. On the Macin‐
82 tosh, the menubar will be displayed across the top of the main
83 monitor. On Microsoft Windows and all UNIX platforms, the menu
84 will appear across the toplevel window as part of the window
85 dressing maintained by the window manager.
86
87 Command-Line Name:-screen
88 Database Name:
89 Database Class:
90
91 Specifies the screen on which to place the new window. Any
92 valid screen name may be used, even one associated with a dif‐
93 ferent display. Defaults to the same screen as its parent.
94 This option is special in that it may not be specified via the
95 option database, and it may not be modified with the configure
96 widget command.
97
98 Command-Line Name:-use
99 Database Name: use
100 Database Class: Use
101
102 This option is used for embedding. If the value is not an empty
103 string, it must be the window identifier of a container window,
104 specified as a hexadecimal string like the ones returned by the
105 winfo id command. The toplevel widget will be created as a child
106 of the given container instead of the root window for the
107 screen. If the container window is in a Tk application, it must
108 be a frame or toplevel widget for which the -container option
109 was specified. This option may not be changed with the config‐
110 ure widget command.
111
112 Command-Line Name:-visual
113 Database Name: visual
114 Database Class: Visual
115
116 Specifies visual information for the new window in any of the
117 forms accepted by Tk_GetVisual. If this option is not speci‐
118 fied, the new window will use the default visual for its screen.
119 The -visual option may not be modified with the configure widget
120 command.
121
122 Command-Line Name:-width
123 Database Name: width
124 Database Class: Width
125
126 Specifies the desired width for the window in any of the forms
127 acceptable to Tk_GetPixels. If this option is less than or
128 equal to zero then the window will not request any size at all.
129______________________________________________________________________________
130
132 The toplevel command creates a new toplevel widget (given by the path‐
133 Name argument). Additional options, described above, may be specified
134 on the command line or in the option database to configure aspects of
135 the toplevel such as its background color and relief. The toplevel
136 command returns the path name of the new window.
137
138 A toplevel is similar to a frame except that it is created as a top-
139 level window: its X parent is the root window of a screen rather than
140 the logical parent from its Tk path name. The primary purpose of a
141 toplevel is to serve as a container for dialog boxes and other collec‐
142 tions of widgets. The only visible features of a toplevel are its
143 background color and an optional 3-D border to make the toplevel appear
144 raised or sunken.
145
147 The toplevel command creates a new Tcl command whose name is the same
148 as the path name of the toplevel's window. This command may be used to
149 invoke various operations on the widget. It has the following general
150 form:
151
152 pathName option ?arg arg ...?
153
154 PathName is the name of the command, which is the same as the toplevel
155 widget's path name. Option and the args determine the exact behavior
156 of the command. The following commands are possible for toplevel wid‐
157 gets:
158
159 pathName cget option
160 Returns the current value of the configuration option given by
161 option. Option may have any of the values accepted by the
162 toplevel command.
163
164 pathName configure ?option? ?value option value ...?
165 Query or modify the configuration options of the widget. If no
166 option is specified, returns a list describing all of the avail‐
167 able options for pathName (see Tk_ConfigureInfo for information
168 on the format of this list). If option is specified with no
169 value, then the command returns a list describing the one named
170 option (this list will be identical to the corresponding sublist
171 of the value returned if no option is specified). If one or
172 more option-value pairs are specified, then the command modifies
173 the given widget option(s) to have the given value(s); in this
174 case the command returns an empty string. Option may have any
175 of the values accepted by the toplevel command.
176
178 When a new toplevel is created, it has no default event bindings:
179 toplevels are not intended to be interactive.
180
181 Be aware that bindings on toplevels may receive events from subwidgets.
182
184 bind(n), bindtags(n), frame(n), wm(n)
185
187 toplevel, widget
188
189
190
191Tk 8.4 toplevel(n)