Tkinter radiobutton border

Jeff Epler jepler at unpythonic.net
Tue Apr 6 22:50:20 EDT 2004


Peter Otten's advice is correct, if all you want to do is get rid of
this 1-pixel area.  However, you may want to use highlightbackground to
set it to green, so that the visual cue for "this widget has keyboard
focus" is retained.

To explain a little more, every widget has a "highlight rectangle"
around it, which has a thickness of highlightthickness and a color of
either highlightcolor (if the widget or a child has focus), or
highlightbackground (otherwise).

A few widgets may actually behave differently (buttons on win32 display
a dotted rectangle between the border and the contents, for instance).
Widgets that don't normally take focus (such as frames and labels) have
a 0 highlightthickness by default, but can be given a highlightthickness.

Widgets that tend to take keyboard focus default to a highlight
thickness of 1, with back for highlightcolor and the system background
color for highlightbackground.  This is why I suggest that you consider
setting the highlightbackground to green.

If you create a scrolled area, you may want to set the
highlightthickness of the scrolled widget to 0, and that of the frame
that encloses it and the scrollbars to 1.  This will make the focus
rectangle surround the scrolled widget and the scrollbars together.

Jeff




More information about the Python-list mailing list