Created
July 30, 2013 15:43
-
-
Save samueldana/6114119 to your computer and use it in GitHub Desktop.
Wx::SplashScreen usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'wx' | |
class Runner < Wx::App | |
attr_accessor :splash | |
def on_init | |
splash_file = File.join(File.dirname(__FILE__), 'media', 'splash.png') | |
splash_bitmap = Wx::Bitmap.new(splash_file, Wx::BITMAP_TYPE_PNG) | |
@splash = Wx::SplashScreen.new(splash_bitmap, | |
Wx::SPLASH_CENTRE_ON_SCREEN|Wx::SPLASH_NO_TIMEOUT, 0, nil, -1) | |
@splash.show | |
# Problem occurs here. | |
# Once we wait_for_server_to_start, splash screen appears to hang. | |
# Windows will prompt user to kill application if the splash screen is clicked. | |
wait_for_server_to_start | |
@splash.destroy | |
true | |
end | |
def on_exit | |
unless $launched | |
$launched = true # Runs twice otherwise | |
launch_browser | |
end | |
end | |
end | |
def wait_for_server_to_start | |
# stuff | |
end | |
def launch_browser | |
# stuff | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment