This is an unofficial mirror of Tkinter reference documentation (based on Python 2.7 and Tk 8.5) created by the late John Shipman.
It was last updated in 2013 and is unmaintained. [More info]
A mark represents a floating position somewhere in the contents of a text widget.
You handle each mark by giving it a name. This name can be any string that doesn't include whitespace or periods.
There are two special marks.
is the current position of the insertion cursor, and
tk.CURRENT is the position closest to the
Marks float along with the adjacent content. If you modify text somewhere away from a mark, the mark stays at the same position relative to its immediate neighbors.
Marks have a property called
gravity that controls what happens
when you insert text at a mark. The default gravity is
tk.RIGHT, which means that when new text is
inserted at that mark, the mark stays after the end of the
new text. If you set the gravity of a mark to
tk.LEFT (using the text widget's
.mark_gravity() method), the mark will stay at a
position just before text newly inserted at that mark.
Deleting the text all around a mark does not remove
the mark. If you want to remove a mark, use the
.mark_unset() method on the text
Refer to Section 24.8, “Methods on
Text widgets”, below, to see
how to use marks.