Next / Previous / Contents / TCC Help System / NM Tech homepage

9. The Frame widget

A frame is basically just a container for other widgets.

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 backgroundThe frame's background color. See Section 4.3, “Colors”.
bd or borderwidthWidth of the frame's border. The default is 0 (no border). For permitted values, see Section 4.1, “Dimensions”.
cursorThe cursor used when the mouse is within the frame widget; see Section 4.8, “Cursors”.
heightThe vertical dimension of the new frame. This will be ignored unless you also call .grid_propagate(0) on the frame.
highlightbackgroundColor of the focus highlight when the frame does not have focus. See Section 23, “Focus: routing keyboard input”.
highlightcolorColor shown in the focus highlight when the frame has the focus.
highlightthicknessThickness of the focus highlight.
reliefThe 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”.
takefocusNormally, 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.
widthThe 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.