title: PySimpleGui: Displaying console output in GUI
body: <p>I wanted to try out some GUI stuff in Python. Im new to both Python and PySimpleGUI. I decided to make a program that when given an IP address would ping it and show the reply in a popup. (super simple i know.)</p>
  <p>It works perfectly, however: It is showing the response in the console, but I want it in the GUI.</p>
  <p>Is it possible to save the console output in a variable and that way show it in the GUI?</p>
  <p>I hope the question makes sense :)</p>
  <p>This is my code:</p>
  <pre><code>#1 Import:
  import PySimpleGUI as sg
  import os
  
  #2 Layout:
  layout = [[sg.Text('Write the IP-address you want to ping:')],
            [sg.Input(key='-INPUT-')],
            [sg.Button('OK', bind_return_key=True), sg.Button('Cancel')]]
  #3 Window:
  window = sg.Window('Windows title', layout)
  
  #4 Event loop:
  while True:
      event, values = window.read()
      os.system('ping -n 1 {}'.format(values['-INPUT-']))
      if event in (None, 'Cancel'):
          break
          
  #5 Close the window:
  window.close()
  </code></pre>