Name

tag_config

Synopsis

                        t.tag_config(tag,**tag_options)

Sets or changes tag options associated with tag tag, determining the way t renders text in tag’s region. The most frequently used tag options are:

background, foreground

Background and foreground colors

bgstipple, fgstipple

Background and foreground stipples, typically 'gray12', 'gray25', 'gray50', or 'gray75'; by default, solid colors (no stippling)

borderwidth

Width in pixels of the text border; default is 0 (no border)

font

Font used for text in the tag’s ranges (see Section 16.6.6 later in this chapter)

justify

Text justification, LEFT (default), CENTER, or RIGHT

lmargin1, lmargin2, rmargin

Left margin (first line, other lines) and right margin (all lines), in pixels; default is 0 (no margin)

offset

Offset from baseline in pixels (greater than 0 for superscript, less than 0 for subscript); default is 0 (no offset, i.e., text aligned with the baseline)

overstrike

If true, draw a line right over the text

relief

Text relief: FLAT (default), SUNKEN, RAISED, GROOVE, or RIDGE

spacing1, spacing2, spacing3

Extra spacing in pixels (before first line, between lines, after last line); default is 0 (no extra spacing)

underline

If true, draw a line under the text

wrap

Wrapping mode: WORD (default), CHAR, or NONE

For example:

t.tag_config(SEL,background='black',foreground='yellow')

tells t to display t’s selected range with yellow text on a black background.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.