gist: 13784 Download_button fork
public
Public Clone URL: git://gist.github.com/13784.git
Text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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
 

Owner

ayucat

Revisions