[Gtk-sharp-list] How to implement a splash screen?

Jiří Zárevúcký zarevucky.jiri at gmail.com
Sat Apr 4 08:38:30 EDT 2009

> Now, the console shows, in order, "Before Run", "Before Sleep", "After
> Sleep". The MainWindow, despite being run in a Gtk.Application invocation,
> does not show until after the function returns. In other words, attempting
> to show a splash screen and doing some heavy work there would result in the
> same problem as the one I'm having. Thanks for your reply, but it is
> unfortunately no solution.

I think it should work like this:

  var window = new Gtk.Window ();
  window.Show ();

  Application.Invoke (DoSomeHeavyWorkHere);

  Application.Run ();

Alternatively, you can use a simple thread:

  using System.Threading;


  var window = new Gtk.Window ();
  window.Show ();

  var thread = new Thread (delegate { DoSomeHeavyWorkHere () });
  thread.Start ();

  Application.Run ();

Of course, as Gtk isn't thread-safe, you'll have to dispatch any GUI
updates from the thread via Application.Invoke.

More information about the Gtk-sharp-list mailing list