title: How can you update the gtkmm gui screen from your c++ code after it is created
body: <p>Can someone help to clear up the confusion of how to update a gui window without user input.</p>
  
  <p>In other words, I would like to be able to output text to either or both the console our the gui window.</p>
  
  <p>At present I can call the gui window (Window with a label for example) and output the initial text.  However, the process doesn't return to my c++ code until the window closes.  I'm trying to figure out how to (or where to have my code) for updating the gui screen before the gui window exits.</p>
  
  <p>This is an example:</p>
  
  <pre><code>#include &lt;gtkmm.h&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char* argv[])
  {
      Gtk::Main kit(argc, argv);
  
      Gtk::Window window;
      Gtk::TextView textview;
      Gtk::Label label;
  
      string mylabeltext = "This is the first line of text in my gui window.\n";
  
      window.set_default_size(600, 360);
      window.set_title("Gtkmm Programming - C++");
      window.set_position(Gtk::WIN_POS_CENTER);
  
      label.show();
      window.add(label);
  
      label.set_text(mylabeltext);
  
      mylabeltext += "About to run some routines...\n";
  
      label.set_text(mylabeltext);
  
      cout &lt;&lt; "An initial line has been set to the gui window." &lt;&lt; endl;
      // The Gui Window is displayed
      Gtk::Main::run(window);
      // Now my main program has performed some functions and wants to update
      // the console and the gui window.
      cout &lt;&lt; "Continuing after various functions and processing..." &lt;&lt; endl;
      mylabeltext = "Showing the results of the functions and processing.";
      label.set_text(mylabeltext);
  
      return 0;
  }
  </code></pre>
  
  <p>The last line of text is never printed to the console until the gui is exited.  The last line of the mylabeltext is never printed to the label window.</p>
  
  <p>What I'm trying to describe is how to keep the gtkmm window active while I run other routines in my c++ code and update the output to both the console and the gui window without closing the gui window to continue the c++ routines.</p>
  
  <p>All the examples that I can find uses a button in the code.  I have tested and experimented enough that I can update the gui screen after a button is pressed.  However, I don't want to have to rely on the user for screen updates.  I hope to be able to run disc scans and other functions and periodically update the screen so that the user can see the progress and know that the program is still working and not dead.</p>
  
  <p>Some of the resources that I have studied in my attempts at understanding this include:</p>
  
  <ul>
  <li><a href="https://developer.gnome.org/" rel="nofollow">https://developer.gnome.org/</a></li>
  <li><a href="https://developer.gnome.org/gtkmm-tutorial/3.2/gtkmm-tutorial.html" rel="nofollow">https://developer.gnome.org/gtkmm-tutorial/3.2/gtkmm-tutorial.html</a></li>
  <li><a href="http://en.wikipedia.org/wiki/Gtkmm" rel="nofollow">http://en.wikipedia.org/wiki/Gtkmm</a></li>
  </ul>