12.07.2015 Views

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

select<strong>for</strong>egroundspacing1spacing2spacing3statetabstakefocuswidthThe <strong>for</strong>eground color to use displaying selectedtext.This option specifies how much extra vertical spaceis put above each line of text. If a line wraps, thisspace is added only be<strong>for</strong>e the first line it occupieson the display. Default is 0.This option specifies how much extra vertical spaceto add between displayed lines of text when a logicalline wraps. Default is 0.This option specifies how much extra vertical spaceis added below each line of text. If a line wraps, thisspace is added only after the last line it occupies onthe display. Default is 0.Normally, text widgets respond to keyboard andmouse events; set this option to NORMAL to get thisbehavior. If you set state to DISABLED, the textwidget will not respond, but you won’t be able tomodify its contents programmatically either.This option controls how tab characters positiontext. The default is to place tabs every eight characters.To set specific tab stops, set this option to asequence of one or more distances.For example, setting tabs to ("3c", "5c", "12c")would put tab stops 3, 5, and 12cm from the leftside. Tabs past the last one you set have the samewidth as the distance between the last two existingtab stops.Normally, text after a tab character is aligned withits left edge on the tab stop, but you can include anyof the keywords LEFT, RIGHT, CENTER, or NUMERICin the list after a distance, and that will change thepositioning of the text after each tab.A LEFT tab stop has the default behavior. A RIGHTtab stop will position the text so its right edge is onthe stop, and a CENTER tab will center the followingtext on the tab stop. A NUMERIC tab stop will placefollowing text to the left of the stop up until the firstperiod (.) in the text—after that, the period will becentered on the stop, and the rest of the text willpositioned to its right.For example, setting tabs to the sequence("0.5i", "0.8i", RIGHT, "1.2i", CENTER,"2i", NUMERIC) would set four tab stops: a leftalignedtab stop half an inch from the left side,a right-aligned tab stop 0.8 ′′ from the left side, acenter-aligned tab stop 1.2 ′′ from the left, and anumeric-aligned tab stop 2 ′′ from the left.Normally, focus will visit a text widget (see Focus,below). Set takefocus to 0 if you do not wantfocus in the widget.The width of the widget in characters (not pixels!),measured according to the current font size.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Text widget Page 53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!