title: How to color a substring in Tkinter canvas
body: <p>I am writing a program that involves displaying some text in a <code>create_text()</code>  box on a Tkinter canvas, within a loop. Each word is displayed, then replaced by the next. Sort of like flash cards. </p>
  
  <p>I need to color one letter of each word, close to the middle of the word, so that when the user is reading the words their eyes focus on the middle of the word. So <code>if len(i)=1, color i[0], if len(i)&gt;= 2 and &lt;= 5, color i[1]</code>, and so on. It needs to be done using the Canvas, and using </p>
  
  <pre><code>canvas.create_text(text = i[focus_index],fill = 'red') 
  </code></pre>
  
  <p>The result should print like this</p>
  
  <pre><code>exaMple
  </code></pre>
  
  <p>(but obviously "m" would be colored red, not be uppercase)</p>