A frame is basically just a container for other widgets.
Your application's root window is basically a frame.
Each frame has its own grid layout, so the gridding of widgets within each frame works independently.
Frame widgets are a valuable tool in making your
application modular. You can group a set of related
widgets into a compound widget by putting them into a
frame. Better yet, you can declare a new class that
inherits from Frame
, adding your
own interface to it. This is a good way to hide the
details of interactions within a group of related
widgets from the outside world.
To create a new frame widget in a root window or frame
named
:master
w
= Frame (master
,option
, ... )
The constructor returns the new frame widget. Options:
bg or
background | The frame's background color. See Section 4.3, “Colors”. |
bd or
borderwidth | Width of the frame's border. The default is 0 (no border). For permitted values, see Section 4.1, “Dimensions”. |
cursor | The cursor used when the mouse is within the frame widget; see Section 4.8, “Cursors”. |
height | The vertical dimension of the new
frame. This will be ignored unless you also call
.grid_propagate(0) on the
frame. |
highlightbackground | Color of the focus highlight when the frame does not have focus. See Section 23, “Focus: routing keyboard input”. |
highlightcolor | Color shown in the focus highlight when the frame has the focus. |
highlightthickness | Thickness of the focus highlight. |
relief | The default relief for a frame is
FLAT , which means the frame
will blend in with its surroundings. To put a
border around a frame, set its
borderwidth to a positive
value and set its relief to one of the standard
relief types; see Section 4.6, “Relief styles”. |
takefocus | Normally, frame widgets are not visited by
input focus (see Section 23, “Focus: routing keyboard input” for an
overview of this topic). However, you can set
takefocus=1 if you want the
frame to receive keyboard input. To handle such
input, you will need to create bindings for
keyboard events; see Section 24, “Events” for
more on events and bindings. |
width | The horizontal dimension of the new frame.
See Section 4.1, “Dimensions”. This value be
ignored unless you also call
.grid_propagate(0) on the
frame. |