-
Notifications
You must be signed in to change notification settings - Fork 14
wxRuby: Sample Program
Randalphwa edited this page Apr 30, 2025
·
2 revisions
Creating a main window and running it is easy to do. Using wxUiEditor, create a wxFrame window (in this example, the class name is created as MainFrame). Generate the file and open it in an editor. At the end of the file, you will see the following comment block:
# ************* End of generated code ***********
# DO NOT EDIT THIS COMMENT BLOCK!
#
# Code below this comment block will be preserved
# if the code for this class is re-generated.
# ***********************************************After this comment block, enter the following code and then save the file.
class App < Wx::App
def on_init
frame = MainFrame.new(nil, Wx::ID_ANY, 'My Ruby Application', Wx::Point.new(512, -1))
frame.show
set_top_window(frame)
true
end
end
App.runNow all you need to do is enter the following in a command line where my_file.rb is the name of the file you created:
ruby my_file.rb