Tags are used to associate names to regions of text which makes easy the task of modifying the display settings of specific text areas. Removes the given mark from the Text widget. Informs a new position to the given mark. If the second argument is provided, the gravity is set for the given mark. Returns the line and column location of a specific mark. We have the following methods available when handling marks − Sr.No. Marks are used to bookmark positions between two characters within a given text. Text widgets support three distinct helper structures: Marks, Tabs, and Indexes − This method returns true if the text located at the index position is visible. This method inserts strings at the specified index location. Returns the absolute value of an index based on the given index. This method returns a specific character or a range of text. This method deletes a specific character or a range of text. To make the text widget vertically scrollable, set this option to the set() method of the vertical scrollbar. To make the text widget horizontally scrollable, set this option to the set() method of the horizontal scrollbar. With the default behavior, wrap=CHAR, any line that gets too long will be broken at any character. Set wrap=WORD and it will break the line after the last word that will fit. This option controls the display of lines that are too wide. The width of the widget in characters (not pixels!), measured according to the current font size. This option controls how tab characters position text. If you set state=DISABLED, the text widget will not respond, and you won't be able to modify its contents programmatically either. Normally, text widgets respond to keyboard and mouse events set state=NORMAL to get this behavior. If a line wraps, this space is added only after the last line it occupies on the display. This option specifies how much extra vertical space is added below each line of text. This option specifies how much extra vertical space to add between displayed lines of text when a logical line wraps. If a line wraps, this space is added only before the first line it occupies on the display. This option specifies how much extra vertical space is put above each line of text. The width of the border to use around selected text. The background color to use displaying selected text. The size of the internal padding added above and below the text area. The size of the internal padding added to the left and right of the text area. Width of the insertion cursor (its height is determined by the tallest item in its line). The number of milliseconds the insertion cursor is on during its blink cycle. Set this option to zero to suppress blinking. The number of milliseconds the insertion cursor is off during its blink cycle. Size of the 3-D border around the insertion cursor. Set highlightthickness=0 to suppress display of the focus highlight. The color of the focus highlight when the text widget has the focus. The color of the focus highlight when the text widget does not have focus. The height of the widget in lines (not pixels!), measured according to the current font size. You can change the color for tagged regions this option is just the default. The color used for text (and bitmaps) within the widget. The default font for text inserted into the widget. Set exportselection=0 if you don't want that behavior. Normally, text selected within a text widget is exported to be the selection in the window manager. The cursor that will appear when the mouse is over the text widget. The width of the border around the text widget. The default background color of the text widget. These options can be used as key-value pairs separated by commas. Options − Here is the list of most commonly used options for this widget. Master − This represents the parent window. Here is the simple syntax to create this widget −
Basic python text editor windows#
Moreover, you can embed windows and images in the text because this widget was designed to handle both plain and formatted text. You can also use elegant structures like tabs and marks to locate specific sections of the text, and apply changes to those areas. Text widgets provide advanced capabilities that allow you to edit a multiline text and format the way it has to be displayed, such as changing its color and font.