O'Reilly logo

Advanced Perl Programming by Sriram Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Tk Widget Reference

The least flexible component of any system is the user.

Lowell Jay Arthur

This appendix covers the most commonly used properties and methods of Tk widgets. Please refer to the extensive online documentation accompanying the Tk distribution for more details.

Table A.1 shows all the properties and methods shared by almost all widgets.

Table A-1. Generic Widget Properties

Properties

Description

font

Discussed in Section 14.3.1.1.

background, foreground

A name (“red”) or an RGB value (“#FF00FA”). The options can also be abbreviated to bg and fg. Discussed in Section 14.3.1.3.

text

The string to be displayed inside the widget. This is displayed in the foreground color in the font specified above.

image, bitmap

Specifies a bitmap to be displayed inside the widget. Refer to the section Section 14.3.1.2 for a discussion on creating and managing bitmaps.

relief

Border style: one of raised, sunken, flat, ridge, or groove. Should be accompanied by a nonzero borderwidth option.

height, width

Typically the height and width in pixels, except for labels, buttons, and text widgets, in which it is in number of characters (a multiple of average character width and height in that widget’s font).

textvariable

Specifies the name of a variable. When the value of a widget changes, this variable is updated, and vice versa.

anchor

Specifies how the widget or the information within it is positioned. Must be one of n, ne, e, se, s, sw, w, nw, or center. For ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required