”参数数量错误” wxRuby 中框架类初始化错误
我正在尝试使用 wxRuby 找到我的方位,并且正在使用 这个,也许已经过时了,使用 ruby 1.9.2p180 的教程 (2011-02-18) [i386-mingw32]
这:
class MinimalApp < App
def on_init
Frame.new(nil, -1, "GUI Mockup").show()
end
end
有效:打开一个空窗口。但是,当我尝试向窗口添加框架时,如下所示:
class MyFrame < Frame
def initialize()
super(nil, -1, 'My Frame Title')
end
end
并将“Frame.new(...”更改为“MyFrame.new”我收到以下错误:
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'
from C:/.../wxTest.rb:24:in `main_loop'
from C:/.../wxTest.rb:24:in `<main>'
此时我有点卡住了。我会感谢您的任何建议。
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'
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,发布后几秒钟,我回答了我自己的问题。问题是
设置选项两次,或者其他什么。改变它就
达到了目的。
噢!
OK, so seconds after posting, I answerd my own question. The problem was that
sets the options twice, or something. Changing it to
did the trick.
D'oh!