title: How to print Tkinter variables as part of a string?
body: <p>In regular Python 3.4, if you want to print a variable in the middle of a string, you do something like this:</p>
  
  <pre><code>x = 31
  print("The value of x is %s" % (x))
  </code></pre>
  
  <p>And it will print <code>The value of x is 31</code>.  </p>
  
  <p>In Tkinter, if you want to have a label read a certain variable, you simply define the label and if at any point the variable of the label changes, the label updates automatically if it's a Tkinter label. For example:</p>
  
  <pre><code>var = StringVar()
  var.set("Label")
  label = Label(main, text=var)
  </code></pre>
  
  <p>However, if I want part of a string to be a variable in Tkinter... </p>
  
  <pre><code>items = IntVar()
  items.set(14)
  b = Button(main, text="I have %s items" % (items.get()), command=additem)
  
  def additem():
      items.set(items.get() + 1)
  </code></pre>
  
  <p>...The button doesn't update. When I press it, the printed value remains <code>"I have 14 items"</code> instead of changing to <code>"I have 15 items"</code> as it should.</p>
  
  <p>How should I go about doing this?</p>