This is an unofficial mirror of Tkinter reference documentation (based on Python 2.7 and Tk 8.5) created by the late John Shipman.
It was last updated in 2013 and is unmaintained. [More info]
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
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
The constructor returns the new
Frame widget options
|The frame's background color. See Section 5.3, “Colors”.|
|Width of the frame's border. The default is 0 (no border). For permitted values, see Section 5.1, “Dimensions”.|
|The cursor used when the mouse is within the frame widget; see Section 5.8, “Cursors”.|
The vertical dimension of the new
frame. This will be ignored unless you also call
|Color of the focus highlight when the frame does not have focus. See Section 53, “Focus: routing keyboard input”.|
|Color shown in the focus highlight when the frame has the focus.|
|Thickness of the focus highlight.|
Normally, a |
Used to add vertical space inside a frame.
The default relief for a frame is |
Normally, frame widgets are not visited by input
focus (see Section 53, “Focus: routing keyboard input” for an overview
of this topic). However, you can set |
The horizontal dimension of the new frame. See
Section 5.1, “Dimensions”. This value be
ignored unless you also call |