Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
error: ...uninitialized constant Wxruby2
Bou Dramé
10/4/2008 4:41:00 PM
I have already installed the wx package with ruby gem:
gem install wxruby and now I am trying to run a gui sample program. As
follow:
require 'wx'
include Wx
class MyFrame < Frame
def initialize()
super(nil, -1, 'My Frame Title')
@my_panel = Panel.new(self)
@my_label = StaticText.new(@my_panel, -1, 'My Label Text',
DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER)
@my_textbox = TextCtrl.new(@my_panel, -1, 'Default Textbox Value')
@my_combo = ComboBox.new(@my_panel, -1, 'Default Combo Text',
DEFAULT_POSITION, DEFAULT_SIZE, ['Item 1', 'Item 2', 'Item 3'])
@my_button = Button.new(@my_panel, -1, 'My Button Text')
end
end
But anytime i try to run the code, I get following error message:
/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.8-x86-mingw32/lib/wx.rb:50:
uninitialized constant Wxruby2::THE_APP (NameError)
Does anybody knows how to solve this problem?
Thanks. Bou
--
Posted via
http://www.ruby-...
.
1 Answer
Alex Fenton
10/4/2008 4:53:00 PM
0
Bou Dramé wrote:
> I have already installed the wx package with ruby gem:
>
> gem install wxruby and now I am trying to run a gui sample program. As
> follow:
>
> require 'wx'
> include Wx
> class MyFrame < Frame
> def initialize()
> super(nil, -1, 'My Frame Title')
> @my_panel = Panel.new(self)
> @my_label = StaticText.new(@my_panel, -1, 'My Label Text',
> DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER)
> @my_textbox = TextCtrl.new(@my_panel, -1, 'Default Textbox Value')
> @my_combo = ComboBox.new(@my_panel, -1, 'Default Combo Text',
> DEFAULT_POSITION, DEFAULT_SIZE, ['Item 1', 'Item 2', 'Item 3'])
> @my_button = Button.new(@my_panel, -1, 'My Button Text')
> end
> end
You need to add some code at the end of your sample to actually show one
of these frames. Something like
App.run do
frame = MyFrame.new
frame.show
end
That should do the trick. You can get more help on the wxruby-users
mailing list:
http://wxruby.rubyforge.org/wiki/wiki.pl?Ma...
The error message you're getting at the moment is a minor bug in 1.9.8,
it's already fixed in Subversion for the upcoming 2.0 release.
alex
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
error: ...uninitialized constant Wxruby2
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password