Hello I'm trying to add highlighting to the specific keywords in the text widget. For instance I would like to highlight : Hello World. where is "hello" - will be coloured in red and "World" coloured green. Any Idea ???
from Tkinter import *
import os
import subprocess
import shutil
import tkFont
import py_compile
#py_compile.compile ("linxtl.py", "linxtl.pye")
import Tkinter as tk
import Tkinter
root = Tk()
class MenuTL(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.createWidgets()
#self.CMENU()
self.master.title("LinXTL v. 0.1")
self.master.iconname("LinXTL")
#text widget
def createWidgets(self):
sbar = Scrollbar(self)
text = Text(self, relief=SUNKEN, font='bold', spacing1='1', undo='true')
sbar.config(command=text.yview)
text.config(yscrollcommand=sbar.set)
sbar.pack(side=RIGHT, fill=Y)
text.pack(side=LEFT, expand=YES, fill=BOTH)
self.text = text
if __name__ == '__main__':
MenuTL().mainloop() # if I'm run as a script
root.mainloop()