Created
September 30, 2008 10:23
-
-
Save ayucat/13784 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team | |
# Freely reusable code: see SAMPLES-LICENSE.TXT for details | |
begin | |
require 'rubygems' | |
rescue LoadError | |
end | |
require 'wx' | |
class MinimalFrame < Wx::Frame | |
def initialize(title) | |
super(nil, :title => title, :size => [ 400, 300 ]) | |
menu_bar = Wx::MenuBar.new | |
menu_file = Wx::Menu.new | |
menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program") | |
menu_bar.append(menu_file, "&File") | |
menu_help = Wx::Menu.new | |
menu_help.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog") | |
menu_bar.append(menu_help, "&Help") | |
self.menu_bar = menu_bar | |
create_status_bar(2) | |
self.status_text = "Welcome to wxRuby!" | |
evt_menu Wx::ID_EXIT, :on_quit | |
evt_menu Wx::ID_ABOUT, :on_about | |
end | |
def on_quit | |
close() | |
end | |
def on_about | |
Wx::about_box(:name => self.title, | |
:version => Wx::WXRUBY_VERSION, | |
:description => "This is the minimal sample", | |
:developers => ['The wxRuby Development Team'] ) | |
end | |
end | |
Wx::App.run do | |
self.app_name = 'Minimal' | |
frame = MinimalFrame.new("Minimal wxRuby App") | |
frame.show | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment