Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

8.16. Marks

There are several ways to refer to different positions throughout the text widget. Index values refer to a character. Tags are named references to a specific character or characters. The term mark is used to refer to the spaces in between characters. Similar to tags, a mark has a name. For example, the "insert" mark refers to the position of the insert cursor. However, tags refer to the actual characters, and if those characters are deleted, the tag is no longer associated with those characters. The mark stays in place whether the characters surrounding it are deleted or other characters are added. Marks can only refer to one location within the text widget at a time.

Once it is created, you can use a mark as an index. The gravity of the mark will affect on which side the text will be inserted. If the gravity is 'right' (the default), the text will be inserted to the left of the mark because the mark is glued to the character to the right of the mark. If the gravity is 'left', the text will be inserted to the left of the mark and the mark will refer to the left of the last character inserted.

There are two special marks that are set automatically by the text widget: "insert"and "current". The "insert" mark is wherever the insert cursor is. The "current" mark is the position closest to the mouse and adjusts as the mouse moves (as long as a mouse button is pressed). Both marks are maintained internally and cannot be deleted.

You will also see a mark called "anchor"

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata