title: Python timer in math game Tkinter
body: <p>I'm looking to add a timer for my simple math game. So far everything works just fine, the user gets questions when pressing the button and is given feedback on the answer. I want to add a timer for the user to see how much time it takes to answer the multiplication. This is the final part of my prototype to this mathgame. I want the timer to start when the user clicks "nytt tal" which means new number in swedish, and to stopp when the user clicks "svar" which means answer in swedish. Here is my code.</p>
  
  <pre>
  from Tkinter import *
  import tkMessageBox
  import random
  import time
  import sys
  
  # Definition for the question asked to user 
  def fraga1():
      global num3 
      num3 = random.randint(1, 10)
      global num4 
      num4 = random.randint(1, 10)
      global svar1 
      svar1 = num3 * num4
      label1.config(text='Vad blir ' + str(num3) + '*' + str(num4) + '?')
      entry1.focus_set()
  
  
  #The answer giving feedback based on answer
  def svar1():
     mainAnswer = entry1.get()
     if len(mainAnswer) == 0:
        tkMessageBox.showwarning(message='Skriv in några nummer!')
     return
     if int(mainAnswer) != svar1:
        tkMessageBox.showwarning(message='Tyvärr det rätta svaret: ' + str(svar1))
     else:
        tkMessageBox.showinfo(message='RÄTT!! :)')
  
  #The quit button definition
  def quit():
     global root
     root.destroy()
  
  #Definition for the timer this part doesnt work
  def start():
     global count_flag 
     fraga1()
     count_flag = True
     count = 0.0
     while True:
        if count_flag == False:
            break
     label['text'] = str(count)
     time.sleep(0.1)
     root.update()
     count += 0.1
  
  
  #Window code
  root = Tk()
  root.title("multiplikations tidtagning")
  root.geometry('800x500')
  
  count_flag = True
  
  # Welcome message in labels
  label2 = Label(root, text="Hej!\n  Nu ska vi lösa lite matteproblem!")
  label2.config(font=('times', 18, 'bold'), fg='black', bg='white')
  label2.grid(row=0, column=0)
  
  #Instructions how to play in labels
  
  label3 = Label(root, text="Instruktioner!\n  För att starta ett spel tryck på nyttspel") 
  label3.config(font=('times', 12, 'bold'), fg='black', bg='white')
  label3.grid(row=2, column=2)
  
  #other label
  label1 = Label(root)
  label1.grid(row=2, column=0)
  
  
  # entry widget for the start button
  entry1 = Entry(root)
  entry1.grid(row=3, column=0)
  
  # restart gives a new question
  entry1.bind('', func=lambda e:checkAnswer())
  
  #Buttons
  
  fragaBtn = Button(root, text='Nytt tal', command=fraga1)
  fragaBtn.grid(row=4, column=0)
  
  svarButton = Button(root, text='Svar', command=svar1)
  svarButton.grid(row=4, column=1)
  
  
  quit_bttn = Button(root, text = "Avsluta", command=quit)
  quit_bttn.grid(row=5, column=0)
  
  
  
  root.mainloop()
  </pre>