Text Widget Options

Options used with the Text method change the way the text is displayed within the Text widget. The following options are standard for all the widgets

-background => color
Changes the color of the screen displayed behind the text. Sets the width of the edges of the widget. Sets the cursor displayed when the mouse cursor is in front of the Text widget. Determines if the text selected within the widget can also be used by the windowing system (such as X windows). Sets the font in which the text is displayed. Sets the color of the text. Sets the height of the widget. Default is 24. Sets the color the highlight rectangle around the widget should be when it does not have the keyboard focus. Sets the color the highlight rectangle around the widget should be when it has the keyboard focus. Sets the thickness of the highlight rectangle around the widget. Default is 2. Changes the color of the insert cursor. Changes the width of the insert cursor. Sets the time the insert cursor blinks in the off position. Default is 300. Sets the time the insert cursor blinks in the on position. Default is 600. Sets the width of the insert cursor. Adds extra space to the left and right of the text inside the Text widget's edge. Adds extra space to the top and bottom of the text inside the Text widget's edge. Sets the relief of the edges of the widget. Sets the color of the area behind the selected text. Sets the width of the border of the selected area. Sets the color of the selected text. Enables gridding for the Text widget. Default is 0. Sets the amount of additional space left on top of a line of text that begins on its own line. Default is 0. Sets the amount of additional space left on top of a line of text after it has been wrapped around automatically by the Text widget. Default is 0. Sets the amount of additional space left after a line of text has been ended by a "\n". Default is 0. Indicates the state of the Text widget. If set to 'disabled', no text can be inserted by either the user or the application (via the insert method). Sets the width of the Text widget in characters. Default is 80. Sets the mode used to determine automatic line wrapping. Determines the callback used when the Text widget is scrolled horizontally. Determines the callback used when the Text widget is scrolled vertically.
-borderwidth => amount
-cursor => cursorname
-exportselection => 0 | 1
-font => fontname
-foreground => color
-height => amount
-highlightbackground => color
-highlightcolor => color
-highlightthickness => amount
-insertbackground => color
-insertborderwidth => amount
-insertofftime => time
-insertontime => time
-insertwidth => amount
-padx => amount
-pady => amount
-relief => 'flat'|'groove'|'raised'|'ridge'|'sunken'|'solid'
-selectbackground => color
-selectborderwidth => amount
-selectforeground => color
-setgrid => 0 | 1
-spacing1 => amount
-spacing2 => amount
-spacing3 => amount
-state => 'normal' | 'disabled'
-tabs => list
Specifies a list of tab stops to use in the Text widget. Default is every eight characters.
-takefocus => 0 | 1 | undef
Determines if widget can obtain keyboard focus.
-width => amount
-wrap => 'none' | 'char' | 'word'
-xscrollcommand => callback
-yscrollcommand => callback
Text

Option name

.Xdefault's name

Class name

Default value

Current value

-background background Background #d9d9d9 #d9d9d9
-bd borderWidth
 
 
 
-bg background
 
 
 
-borderwidth borderWidth BorderWidth 2 2
-cursor cursor Cursor xterm xterm
-disabledtile disabledtile Tile undef
 
-exportselection exportSelection ExportSelection 1 1
-fg foreground
 
 
 
-font font Font Courier -12 Tk::Font=SCALAR(0x8731bf0)
-foreground foreground Foreground Black Black
-height height Height 24 24
-highlightbackground highlightBackground HighlightBackground #d9d9d9 #d9d9d9
-highlightcolor highlightColor HighlightColor Black Black
-highlightthickness highlightThickness HighlightThickness 1 1
-insertbackground insertBackground Foreground Black Black
-insertborderwidth insertBorderWidth BorderWidth 0 0
-insertofftime insertOffTime OffTime 300 300
-insertontime insertOnTime OnTime 600 600
-insertwidth insertWidth InsertWidth 2 2
-offset offset Offset 0 0 ARRAY(0x875ae58)
-padx padX Pad 1 1
-pady padY Pad 1 1
-relief relief Relief sunken sunken
-selectbackground selectBackground Foreground #c3c3c3 #c3c3c3
-selectborderwidth selectBorderWidth BorderWidth 1 1
-selectforeground selectForeground Background Black Black
-setgrid setGrid SetGrid 0 0
-spacing1 spacing1 Spacing 0 0
-spacing2 spacing2 Spacing 0 0
-spacing3 spacing3 Spacing 0 0
-state state State normal normal
-tabs tabs Tabs
 
undef
-takefocus takeFocus TakeFocus undef undef
-tile tile Tile undef
 
-width width Width 80 80
-wrap wrap Wrap char char
-xscrollcommand xScrollCommand ScrollCommand
 
undef
-yscrollcommand yScrollCommand ScrollCommand
 
undef
原文地址:https://www.cnblogs.com/greencolor/p/2080112.html