title: Display console on screen
body: <p>so I have a basic alarm python GUI, nothing fancy is still in need of a lot of work. So currently my code works as follow: The user clicks &quot;create new alarm&quot; and it opens a window with 3 option menu widgets and selected the time he wants the alarm to go off, then once the set alarm is clicked a loop is run that counts down at one second every time the loop is repeated and the time is printed in the console than when the time they set is equal to the current time the alarm goes off.</p>
  <p>Now my problem is that I want that countdown that is in the console to be displayed on the GUI. I tried to simply make a label and use .get to fetch the current value and display them but once the loop starts it won't do any other code. If I have any other suggestions I am all ears. All i want is a countdown that shows how much time till the alarm goes off, my current idea in my trial and error plan is to display the console.</p>
  <p>Here is my code:</p>
  <pre><code># Import Required Library
  from tkinter import *
  import datetime
  import time
  import winsound
  from threading import *
  from tkinter import messagebox
  
  def submit():
  
      def alarm(Curent):
          # Infinite Loop
          while True:
              # Set Alarm
              set_alarm_time = f&quot;{hour.get()}:{minute.get()}:{second.get()}&quot;
  
              # Wait for one seconds
              time.sleep(1)
  
              # Get current time
              current_time = datetime.datetime.now().strftime(&quot;%H:%M:%S&quot;)
              print(current_time,set_alarm_time)
  
              Curent = current_time
              set = set_alarm_time
  
  
              # Check whether set alarm is equal to current time or not
              if current_time == set_alarm_time:
                  print(&quot;Time to Wake up&quot;)
                  # Playing sound
                  winsound.PlaySound(&quot;sound.wav&quot;,winsound.SND_ASYNC)
                  messagebox.showinfo(title=&quot;ALARM&quot;, message=&quot;Alarm is going off, its time to wake up!&quot;)
                  break
  
  
      root = Tk()
      root.geometry(&quot;400x300&quot;)
      root.config(bg=&quot;#447c84&quot;)
      root.title('MathAlarm')
  
      # Add Labels, Frame, Button, Optionmenus
      Label(root,text=&quot;Alarm Clock&quot;,font=(&quot;Helvetica 20 bold&quot;),fg=&quot;Black&quot;).pack(pady=10)
      Label(root,text=&quot;Set Time&quot;,font=(&quot;Helvetica 15 bold&quot;)).pack()
  
      frame = Frame(root)
      frame.pack()
  
      hour = StringVar(root)
      hours = ('00', '01', '02', '03', '04', '05', '06', '07',
              '08', '09', '10', '11', '12', '13', '14', '15',
              '16', '17', '18', '19', '20', '21', '22', '23', '24'
              )
      hour.set(hours[0])
  
      hrs = OptionMenu(frame, hour, *hours)
      hrs.pack(side=LEFT)
  
      minute = StringVar(root)
      minutes = ('00', '01', '02', '03', '04', '05', '06', '07',
              '08', '09', '10', '11', '12', '13', '14', '15',
              '16', '17', '18', '19', '20', '21', '22', '23',
              '24', '25', '26', '27', '28', '29', '30', '31',
              '32', '33', '34', '35', '36', '37', '38', '39',
              '40', '41', '42', '43', '44', '45', '46', '47',
              '48', '49', '50', '51', '52', '53', '54', '55',
              '56', '57', '58', '59', '60')
      minute.set(minutes[0])
  
      mins = OptionMenu(frame, minute, *minutes)
      mins.pack(side=LEFT)
  
      second = StringVar(root)
      seconds = ('00', '01', '02', '03', '04', '05', '06', '07',
              '08', '09', '10', '11', '12', '13', '14', '15',
              '16', '17', '18', '19', '20', '21', '22', '23',
              '24', '25', '26', '27', '28', '29', '30', '31',
              '32', '33', '34', '35', '36', '37', '38', '39',
              '40', '41', '42', '43', '44', '45', '46', '47',
              '48', '49', '50', '51', '52', '53', '54', '55',
              '56', '57', '58', '59', '60')
      second.set(seconds[0])
  
      secs = OptionMenu(frame, second, *seconds)
      secs.pack(side=LEFT)
  
      Button(root,text=&quot;Set Alarm&quot;,font=(&quot;Helvetica 15&quot;),command=alarm).pack(pady=20)
      Button(root,text=&quot;Exit&quot;,font=(&quot;Helvetica 15&quot;), command=lambda:root.destroy()).pack(pady=20)
  
  root = Tk()
  root.title('MathAlarm')
  root.geometry('347x400')
  root.config(bg=&quot;#447c84&quot;)
  
  welcomelabel = Label(root, text=&quot;Welcome to Math Alarm&quot;, font=(&quot;Times&quot;, &quot;24&quot;, &quot;bold&quot;))
  welcomelabel.pack()
  
  ext = Button(root, text=&quot;Exit&quot;, padx=20, pady=10, relief=SOLID, font=(&quot;Times&quot;, &quot;14&quot;, &quot;bold&quot;), command=lambda:root.destroy())
  reg = Button(root, text=&quot;Create new Alarm&quot;, padx=20, pady=10, relief=SOLID, font=(&quot;Times&quot;, &quot;14&quot;, &quot;bold&quot;), command=submit)
  ext.pack()
  reg.pack()
  
  # Execute Tkinter
  root.mainloop()`
  </code></pre>