If modifiers follow the base index, each one of them must have one of the forms listed below. There may be any number of embedded windows in a text widget, and any widget may be used as an embedded window subject to the usual rules for geometry management, which require the text window to be the parent of the embedded window or a descendant of its parent. Note that this index type is considered after all the others, which means that matches for menu items labelled last, active, or none may be interpreted as the above literals, instead. Tags allow different portions of the text to be displayed with different fonts and colors. These semantics mean that the mark previous operation can be used to step through all the marks in a text widget in the reverse order as the mark information returned by the dump operation. The embedded window's position on the screen will be updated as the text is modified or scrolled, and it will be mapped and unmapped as it moves into and out of the visible area of the text widget.
Index identifies the embedded window, and option specifies a particular configuration option, which must be one of the ones listed in above. If no -window option has been specified for the annotation this callback will be evaluated when the annotation is about to be displayed on the screen. Returns a list whose elements are the names of all the tags that are active at the character position given by index. If a separator is already present at the top of the undo stack no other will be inserted. It has the same legal values as the -wrap option for the text widget: none, char, or word. Returns: The current gravity setting, if direction was omitted.
The first two elements of the list give the x and y coordinates of the upper-left corner of the area occupied by the line, the third and fourth elements give the width and height of the area, and the fifth element gives the position of the baseline for the line, measured down from the top of the area. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the text such as its default background color and relief. Eliding an embedded window immediately after scheduling it for creation via pathName window create index -create will prevent it from being effectively created. The behavior of texts can be changed by defining new bindings for individual widgets or by redefining the class bindings. Each position may optionally be followed in the next list element by one of the keywords left, right, center, or numeric, which specifies how to justify text relative to the tab stop.
This allows a text widget to reflect only a portion of a larger piece of text. If a line of text wraps, this option only applies to the first line on the display; the -lmargin2 option controls the indentation for subsequent lines. If the first non-elided character of a text line has a tag for which this option has been specified, then pixels specifies how much the line should be indented from the left edge of the window. A multi-line block of text that contains no marks or tag transitions will still be dumped as a set of text seqments that each end with a newline. If the current index refers to the last character of the text then it is not modified.
If the characters around a mark are deleted the mark will still remain; it will just have new neighbor characters. If a character has several tags associated with it, and if their display options conflict, then the options of the highest priority tag are used. A window is also treated as a single character. Command-Line Name: -tabs Database Name: tabs Database Class: Tabs Specifies a set of tab stops for the window. Tab distances must be strictly positive, and must always increase from one tab stop to the next if not, an error is thrown. If you insert text on a mark, the mark is moved according to its gravity setting. The undo mechanism is also linked to the modified flag.
The following table lists the other event fields you can access, and how they are denoted in Tk, which can be useful when referring to the Tk man pages. Each position may optionally be followed in the next list element by one of the keywords left, right, center, or numeric, which specifies how to justify text relative to the tab stop. Mark names are ordinary strings, and they can contain anything except whitespace for convenience, you should avoid names that can be confused with indexes, especially names containing periods. Adjust the index to refer to the first character of the word containing the current index. . Default is 0 no extra spacing. If omitted, only one character is deleted.
See below for the edit widget command that controls the undo mechanism. It may have any of the forms accepted by. The fourth form of annotation allows Tk images to be embedded in a text widget. The fractions refer only to the lines that are actually visible in the window: if the lines in the window are all very short, so that they are entirely visible, the returned fractions will be 0 and 1, even if there are other lines in the text that are much wider than the window. As the exception suggest, TypeError: eval arg 1 must be a string, bytes or code object You should pass string, bytes or code object as eval parameter. It may have any of the usual forms defined for a screen distance.
After destroying an elided embedded image, the latter won't get automatically recreated. If the character is only partially visible on the screen, then the return value reflects just the visible part. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that don't fit on the screen are not displayed. The peer will simply become an empty shell on which the background can be configured, but which will never show any content without manual reconfiguration of the start and end lines. Where must have one of the values top align the top of the image with the top of the line , center center the image within the range of the line , bottom align the bottom of the image with the bottom of the line's area , or baseline align the bottom of the image with the baseline of the line.
Elided data is not displayed and takes no space on screen, but further on behaves just as normal data. When saying this you have abbreviated words and included numbers in your sentence. If multiple peer widgets are in use, it is usually simpler to use the -create option if embedded windows are desired in each peer. When the last Python reference to the image object is deleted, the image data is deleted as well, and Tk will display an empty box wherever the image was used. Set the insertOffTime attribute to 0 avoid this.
Keywords such as chars and wordend may be abbreviated as long as the abbreviation is unambiguous. The callback is called as follows:. Option may have any of the values accepted by the tag configure method. This command is similar to the configure method except that it modifies options associated with the tag given by tagName instead of modifying options for the overall text widget. Although they tend to be grammatically incorrect and slightly confusing, they are commonly used and practical, making sending text messages quick and easier on your fingers.