Home Contact

TkDocs

Information you need to build high-quality Tk user interfaces.

close

Modern Tkinter ebook If you've found the material on this site useful, please consider purchasing this e-book (only $10), which is based on the Python material in the tutorial. Doing so helps me maintain and update this site. Thank you very much!


 
 
@markroseman
mark@markroseman.com

 

Kindle Buy now for your Kindle
Kindle apps are also available for most smartphones, tablets, and desktops. Payment and download handled by Amazon's Kindle Store.

 

PDF Buy the DRM-free PDF
Downloads handled by digitaldeliveryapp.com. Payment handled via PayPal (click "Don't have a PayPal account" to use a credit card).

The widget roundup provides you with a quick and easy reference to the most important features and options for each Tk widget.

Label

Widget Essentials

When to use: To show a static text or image to the user, whether identifying some other user interface element (e.g. "Name" next to an entry), something purely decorative, or presenting a result. Users normally do not interact with labels.
Tcl usage: ttk::label .lbl -text "Name:"
Ruby usage: Tk::Tile::Label.new(parent) {text "Name:"}
Reference: (at www.tcl.tk)

Common Options

text The text string to be shown in the label.
textvariable As an alternative to text, get the string from a variable, updating when the variable changes.
image,
compound
Specify a Tk Image object (not the path to an image file) instead of the text string. If compound is center, top, bottom, left, or right, display the text and the image.
justify Alignment of text: left, center or right.
wraplength For multi-line labels; let Tk calculate the line breaks rather than explicitly embedding newlines in the text string.