4.12. Altering the Button's Style
-relief => 'flat'|'groove'|'raised'|'ridge'|'sunken'|'solid'
The default for a Button widget is 'raised' and for Checkbuttons and Radiobuttons it is 'flat'.
Each value changes the look of the Button slightly, as you can see in Figure 4-20. Here is a list of the styles:
No matter which value is specified for the -relief option, when the Button is pressed with the mouse, its relief will change to 'sunken'.
Figure 4-20. Different relief types for a Button
Figure 4-21. Different relief types for a Checkbutton
Figure 4-22. Different relief types for a Radiobutton
-borderwidth => amount
The default -borderwidth for a Button is 2 and for a Checkbutton and a Radiobutton is 0. The wider the -borderwidth, the more dramatic the effects of the -relief option become. Figure 4-23 shows what a -borderwidth of 10 does to each relief type for a Button. When changing the -borderwidth on a Checkbutton or Radiobutton, be careful you don't use too large a value, because the indicators do funny things at larger values. Take a look at Figures Figure 4-24 through Figure 4-27 for clarification. Hopefully seeing how silly these look here, you won't waste time wondering why your own indicators don't work.
Figure 4-23. Different relief types for a Button with -borderwidth set to 10
Figure 4-24. Checkbuttons with -borderwidth => 4
Figure 4-25. Checkbuttons with -borderwidth => 10
Figure 4-26. Radiobuttons with -borderwidth => 4
Figure 4-27. Radiobuttons with -borderwidth => 10
Note that using -borderwidth with values greater than 4 makes widgets look extremely odd. In each of the widget chapters, you'll find a screenshot showing what happens to the widget with a larger -borderwidth value for each of the possible -relief values. The best use of -borderwidth is making one widget stand out more than the others temporarily during development. (You can also use this trick with Frames to figure out where the Frame is. Normally they are invisible. See Chapter 11, " Frame, MainWindow,and Toplevel Widgets" for more on this.)
Copyright © 2002 O'Reilly & Associates. All rights reserved.