I am trying to find my bearings using wxRuby, and am using this, perhaps outdated, tutorial with ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
This:
class MinimalApp < App
def on_init
Frame.new(nil, -1, "GUI Mockup").show()
end
end
works: brings up an empty window. However, when I try to add a frame to the window, as so:
class MyFrame < Frame
def initialize()
super(nil, -1, 'My Frame Title')
end
end
and change "Frame.new(... " to "MyFrame.new" I get the following error:
C:/.../wxTest.rb:8:in `initialize': wrong number of arguments (3 for 0) (ArgumentError)
from C:/.../wxTest.rb:19:in `new'
from C:/.../wxTest.rb:19:in `on_init'
开发者_StackOverflow from C:/.../wxTest.rb:24:in `main_loop'
from C:/.../wxTest.rb:24:in `<main>'
At this point I am kind of stuck. I would be grateful for any suggestions.
OK, so seconds after posting, I answerd my own question. The problem was that
MyFrame.new.(nil, -1, "Multipass GUI Mockup").show()
sets the options twice, or something. Changing it to
MyFrame.new.show()
did the trick.
D'oh!
精彩评论