I'm trying color the text in the Tkinter text widget with help of tags in this way:
text = self.text_field.get(1.0, 'end') #text_field is a text widget
s = re.findall("\d+", text)
for i in s:
self.text_field.tag_add(i, '1.0', 'end')
self.text_field.tag_configure(i, background='yellow',
font='helvetica 14 bold', relief='raised')
The idea is that all tags are being dynamically created, because I get numbers from text widget and they can have any length. This code colors all text in the widget, but I need only numbers to be colored.
Any suggestions?