title: how do I make Python tkinter message box show a number from elsewhere in the script
body: <p>Will preface this by saying i am very new to python and coding in general,
  I followed a tutorial on how to make a countdown timer, and have managed to code a button that measures the amount of times it has been clicked by mashing my code for the button with a post i found on a forum, the count down timer displays a &quot;Times up&quot; message box at the end, what i want to do is have it also display the amount of times the button is clicked in the allotted time. I've tried calling the global count from within the countdown timer and reusing the line that displays the count in the GUI but this seems to break it and doing it without it as displayed here simply shows the string as it is written, any help or guidance is appreciated</p>
  <p>'''</p>
  <pre><code>import time
  from tkinter import *
  from tkinter import messagebox
  
  f = (&quot;Arial&quot;,24)
  
  root = Tk()
  root.title(&quot;Click Counter&quot;) 
  root.config(bg='#345')
  root.state('zoomed') #opens as maximised, negating the need for the 'Geometry' command
  
  count = 0
  
  def clicked(): 
      global count
  
      count = count + 1
  
      myLabel.configure(text=f'Button was clicked {count} times!!!')
  
  hour=StringVar()
  minute=StringVar()
  second=StringVar()
  
  hour.set(&quot;00&quot;)
  minute.set(&quot;00&quot;)
  second.set(&quot;10&quot;)
  
  hour_tf= Entry(
      root, 
      width=3, 
      font=f,
      textvariable=hour
      )
  
  hour_tf.place(x=80,y=20)
  
  mins_tf= Entry(
      root, 
      width=3, 
      font=f,
      textvariable=minute)
  
  mins_tf.place(x=130,y=20)
  
  sec_tf = Entry(
      root, 
      width=3, 
      font=f,
      textvariable=second)
  
  sec_tf .place(x=180,y=20)
  
      
  TheButton = Button(root, height= 30, width=100, bg=&quot;light blue&quot;, text=&quot;Click For Your Life&quot;, command=clicked) #tells the button to call the function when clicked
  
  TheButton.pack()
  
  myLabel = Label(root) 
  myLabel.pack()  
  
  
  def startCountdown():
      
      try:
          userinput = int(hour.get())*3600 + int(minute.get())*60 + int(second.get())
      except:
          messagebox.showwarning('', 'Invalid Input!')
      while userinput &gt;-1:
          mins,secs = divmod(userinput,60) 
  
          hours=0
          if mins &gt;60:
              
          
              hours, mins = divmod(mins, 60)
      
          hour.set(&quot;{0:2d}&quot;.format(hours))
          minute.set(&quot;{0:2d}&quot;.format(mins))
          second.set(&quot;{0:2d}&quot;.format(secs))
  
      
          root.update()
          time.sleep(1)
  
      
          if (userinput == 0):
              messagebox.showinfo(&quot;Time's Up!!&quot;, &quot;you clicked (count) times&quot;)
          
  
          userinput -= 1
  
  
  
  
  start_btn = Button(
      root, 
      text='START', 
      bd='5',
      command= startCountdown
      )
  
  start_btn.place(x = 120,y = 120)
  
  
  
  root.mainloop()
  '''
  </code></pre>