title: Tkinter dynamically changing text colour of recurring strings in a textbox
body: <p>I have a Tkinter textbox set to display the contents of a file. An example line from which would be as follows:</p>
  
  <pre><code>SUCCESS - Downloaded example.jpg
  File was 13KB in size
  </code></pre>
  
  <p>What I want to do is have any line containing the word "SUCCESS" have it's text colour changed to blue. Please note that I need this to be dynamic since this word could be found hundreds of times in the one file and there's no way of predicting where it will be.
  This is the code I am using to output the file contents to the text box. Which works fine.</p>
  
  <pre><code>log = open(logFile, 'r')
  while 1:
      line = log.readline()
      if len(line) == 0:
          break
      else:
          self.txtLog.insert(Tkinter.END, line)
          self.txtLog.insert(Tkinter.END, os.linesep)
  log.close()
  </code></pre>
  
  <p>I'm trying to use tag_add and tag_config like the example lines below but to no avail.</p>
  
  <pre><code> `self.txtLog.tag_add("success", "1.0", "1.8")
    self.txtLog.tag_config("success", foreground="blue")`
  </code></pre>
  
  <p>`</p>