Skip to content

Commit

Permalink
Add sample colorizer
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin7 committed Nov 9, 2021
1 parent a2cffd9 commit 237904b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/components/utils/colorizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import tkinter as tk


def search(text_widget, keyword, tag):
pos = 1.0
while True:
idx = text_widget.search(keyword, pos, END)
if not idx:
break
pos = '{}+{}c'.format(idx, len(keyword))
text_widget.tag_add(tag, idx, pos)

0 comments on commit 237904b

Please sign in to comment.