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