code: def the_gui(gui_queue):
      
      layout = [ [sg.Text('Multithreaded Window Example')],
                 [sg.Text('', size=(15,1), key='_OUTPUT_')],
                 [sg.Output(size=(40,6))],
                 [sg.Button('Exit')],]
  
      window = sg.Window('Multithreaded Window').Layout(layout)
      # --------------------- EVENT LOOP ---------------------
      while True:
          event, values = window.Read(timeout=100)        # wait for up to 100 ms for a GUI event
          if event is None or event == 'Exit':
              break
          #--------------- Loop through all messages coming in from threads ---------------
          while True:                 # loop executes until runs out of messages in Queue
              try:                    # see if something has been posted to Queue
                  message = gui_queue.get_nowait()
              except queue.Empty:     # get_nowait() will get exception when Queue is empty
                  break               # break from the loop if no more messages are queued up
              # if message received from queue, display the message in the Window
              if message:
                  window.Element('_OUTPUT_').Update(message)
                  window.Refresh()    # do a refresh because could be showing multiple messages before next Read
  
      # if user exits the window, then close the window and exit the GUI func
      window.Close()
docs: Starts and executes the GUI
      Reads data from a Queue and displays the data to the window
      Returns when the user exits / closes the window
          (that means it does NOT return until the user exits the window)
      :param gui_queue: Queue the GUI should read from
      :return: