Tkinter入门
前页 | 第6章 组件风格 | 后页

# 边框

All Tkinter widgets have a border (though it's not visible by default for some widgets). The border consists of an optional 3D relief, and a focus highlight region.

## Relief

The relief settings control how to draw the widget border:

`borderwidth` (or `bd` ) is the width of the border, in pixels. Most widgets have a default borderwidth of one or two pixels. There's hardly any reason to make the border wider than that.

`relief` controls how to draw the 3D border. It can be set to one of `SUNKEN` , `RAISED` , `GROOVE` , `RIDGE` , and `FLAT` .

## Focus Highlights

The highlight settings control how to indicate that the widget (or one of its children) has keyboard focus. In most cases, the highlight region is a border outside the relief. The following options control how this extra border is drawn:

The `highlightcolor` is used to draw the highlight region when the widget has keyboard focus. It's usually black, or some other distinct contrast color.

The `highlightbackground` is used to draw the highlight region when the widget doesn't have focus. It's usually same as the widget background.

The `highlightthickness` option is the width of the highlight region, in pixels. It is usually one or two pixels for widgets that can take keyboard focus.

前页 | Home | 后页
Text Formatting | Up | Cursors