title: Display realtime output of a subprocess in a tkinter widget
body: <p>My question is almost the same as this one:
  <a href="https://stackoverflow.com/questions/8133487/widget-to-display-subprocess-stdout">Widget to Display subprocess stdout?</a>
  but a step further.</p>
  
  <p>I have the following code (python2.7):</p>
  
  <pre><code>def btnGoClick(p1):
      params = w.line.get()
      if len(params) == 0:
          return
  
      # create child window
      win = tk.Toplevel()
      win.title('Bash')
      win.resizable(0, 0)
      # create a frame to be able to attach the scrollbar
      frame = ttk.Frame(win)
      # the Text widget - the size of the widget define the size of the window
      t = tk.Text(frame, width=80, bg="black", fg="green")
      t.pack(side="left", fill="both")
      s = ttk.Scrollbar(frame)
      s.pack(side="right", fill="y")
      # link the text and scrollbar widgets
      s.config(command=t.yview)
      t.config(yscrollcommand=s.set)
      frame.pack()
  
      process = subprocess.Popen(["&lt;bashscript&gt;", params], shell=False,
          stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  
      while True:
          out = process.stdout.readline()
          if out == '' and process.poll() is not None:
              break
          print out
          t.insert(tk.END, out)
  </code></pre>
  
  <p>The output from the "longrunning" bash script is captured in realtime (appear in the console) but the Tkinter window appear only after the end of the subprocess !!</p>
  
  <p>How can I have the window appearing before the subprocess start and update its content in realtime ?</p>