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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16.6 Methods on text widgetsTo create a text widget as the child of a root window or frame named master:w = Text ( master, *options )The constructor returns the new text widget. Options include:backgroundThe default background color of the text widget.May be abbreviated as bg.borderwidthThe width of the border around the text widget.Default is 2 pixels.cursorThe cursor that will appear when the mouse is overthe text widget. See Cursors, above.exportselection Normally, text selected within a text widget is exportedto be the selection in the window manager.Set this option to 0 if you don’t want that behavior.fontThe default font <strong>for</strong> text inserted into the widget.Note that you can have multiple fonts in the widgetsby using tags to change the properties of sometext. See Fonts, above.<strong>for</strong>egroundThe color used <strong>for</strong> text (and bitmaps) within thewidget. You can change the color <strong>for</strong> tagged regions;this option is just the default. May be abbreviatedas fg.heightThe height of the widget in lines (not pixels!), measuredaccording to the current font size.highlightbackground The color of the focus highlight when the text widgetdoes not have focus. See Focus, below.highlightcolor The color of the focus highlight when the text widgethas the focus. See Focus, below.highlightthickness The thickness of the focus highlight. Default is 1.Set to 0 to suppress display of the focus highlight.See Focus, below.insertbackground The color of the insertion cursor. Default is black.insertborderwidth Size of the 3-D border around the insertion cursor.Default is 0.insertofftime The number of milliseconds the insertion cursor isoff during its blink cycle. Set this option to zero tosuppress blinking. Default is 300.insertontime The number of milliseconds the insertion cursor ison during its blink cycle. Default is 600.insertwidthWidth of the insertion cursor (its height is determinedby the tallest in its line). Default is 2 pixels.padxThe size of the internal padding added to the leftand right of the text area. Default is one pixel.padyThe size of the internal padding added above andbelow the text area. Default is one pixel.reliefThe 3-D appearance of the text widget. Default isSUNKEN.selectbackground The background color to use displaying selectedtext.selectborderwidth The width of the border to use around selected text.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Text widget Page 52

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

Saved successfully!

Ooh no, something went wrong!