March 2018
Beginner to intermediate
422 pages
10h 33m
English
Tags are used to annotate text with an identification string that can then be used to manipulate the tagged text. Tkinter has a built-in tag called SEL, which is automatically applied to the selected text. In addition to SEL, you can define your own tags. A text range can be associated with multiple tags, and the same tag can be used for many different text ranges.
Here are some examples of tagging:
my_text.tag_add('sel', '1.0', 'end') # add SEL tag from start(1.0) to endmy_text.tag_add('danger', "insert linestart", "insert lineend+1c")my_text.tag_remove('danger', 1.0, "end")my_text.tag_config('danger', background=red)my_text.tag_config('outdated', overstrike=1)
You can specify the visual style for a given tag with tag_config, using ...
Read now
Unlock full access