title: Infinite loop to read text file
body: <p>I am trying to read from a text file and print it to my GUI. The text file is being updated every 5 seconds from an outside source. I want to read this file (one line of 4 numbers) and update (overwrite) the previous entry in the text widget. I have been searching for hours and I can't seem to find a viable solution. Basically, push a button, start an infinite loop to read data from a text file, display that data in a text widget in my GUI, and repeat every 5 seconds, overwriting the old data in the widget with the new data.
  Here is a snippet of my code so far:</p>
  
  <pre><code>from tkinter import*
  root=Tk()
  import tkinter as Tk
  import os
  import time
  starttime=time.time()
  def exitProgram():
      print('I will now exit')
      root.destroy()
  def runScript():
      print('I ran something')
      f = open("months.txt")
      two=Label(root, text=f.readlines(),bg='white',fg='blue')
      two.pack(side=TOP, fill=BOTH)
      two.config(font=("Courier",150))
      #time.sleep(5.0-((time.time()-starttime)%5.0))
  </code></pre>