Hi, I am trying to use wxruby2-preview (0.0.38) on my intel macbook running os10.4.8. I am having a beast of a time running the examples in the tutorials. The super basic frame example worked but the simple grid tutorial bombs with the following message: ------ [WhiteGhost:~/tmp/wxStff] hjw$ ruby ./grid.rb /usr/local/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.38-i686- darwin8.4.1/lib/wx/classes/app.rb:10: warning: method redefined; discarding old on_assert ./grid.rb:10: [BUG] Bus Error ruby 1.8.4 (2005-12-24) [i686-darwin8.8.3] Abort trap --------------- The code is below, line 10 is the call to tgrid = Wx::Grid.new(frame, -1), what the heck am I missing? The bigdemo works (although it usually crashes after I''ve run a three or four of the demos) so I think that everything''s installed properly on my system. I copied the code below from the tutorial---------- #!/usr/bin/env ruby -w require ''rubygems'' require ''wx'' app = Wx::App.new frame = Wx::Frame.new( nil , -1 , "MiniApp" ) #grid = Wx::Grid.new( frame , 2000, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::WANTS_CHARS,"this the panel name" ) tgrid = Wx::Grid.new(frame, -1) tgrid.create_grid( 19 , 16 ) frame.show() app.main_loop() --------- Any help would be appreciated I have to get a little utility running on my mac and a windows machine before the 18th. Sincerely, Hawley
Alex Fenton
2007-Jan-04 06:29 UTC
[Wxruby-users] grid control example doesn''t work on osx.4
Hi Hawley> I am trying to use wxruby2-preview (0.0.38) on my intel macbook > running os10.4.8. I am having a beast of a time running the examples > in the tutorials.Apologies, it appears no-one has reviewed the code in the wiki tutorials for some time, and they have got out of date. Suggest you refer to the samples supplied with wxruby2-preview in preference.> The code is below, line 10 is the call to tgrid = Wx::Grid.new(frame, > -1), what the heck am I missing?The tutorial and the example you give are trying to create widgets (Frames, Grids) outside of the on_init loop of you App. This will definitely cause the kind of problems you''re seeing. Try structuring your code like this: require ''wx'' class GridApp < Wx::App def on_init frame = Wx::Frame.new(nil, -1, "Grid wxRuby App") grid = Wx::Grid.new(frame, -1) grid.create_grid(5, 5) frame.show() end end GridApp.new.main_loop> Any help would be appreciated I have to get a little utility running > on my mac and a windows machine before the 18th. >Thanks for trying wxruby - but to be honest, if you''re up against a deadline right now I''d suggest using Tk or Fox whose ruby bindings are more mature. good luck alex
Sean Long
2007-Jan-04 06:35 UTC
[Wxruby-users] grid control example doesn''t work on osx.4
Hawley, Try using this version, you need to subclass Wx::App: #!/usr/bin/env ruby -w require ''rubygems'' require ''wx'' class MyApp < Wx::App def on_init frame = Wx::Frame.new( nil , -1 , "MiniApp" ) tgrid = Wx::Grid.new(frame, -1) tgrid.create_grid( 19 , 16 ) frame.show() end end MyApp.new().main_loop() This works on intel iMac Sean On 1/3/07, Hawley Waldman <hawleyw at gmail.com> wrote:> Hi, > I am trying to use wxruby2-preview (0.0.38) on my intel macbook > running os10.4.8. I am having a beast of a time running the examples > in the tutorials. The super basic frame example worked but the > simple grid tutorial bombs with the following message: > ------ > [WhiteGhost:~/tmp/wxStff] hjw$ ruby ./grid.rb > > /usr/local/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.38-i686- > darwin8.4.1/lib/wx/classes/app.rb:10: warning: method redefined; > discarding old on_assert > ./grid.rb:10: [BUG] Bus Error > ruby 1.8.4 (2005-12-24) [i686-darwin8.8.3] > > Abort trap > --------------- > > The code is below, line 10 is the call to tgrid = Wx::Grid.new(frame, > -1), what the heck am I missing? The bigdemo works (although it > usually crashes after I''ve run a three or four of the demos) so I > think that everything''s installed properly on my system. I copied the > code below from the tutorial---------- > > #!/usr/bin/env ruby -w > > require ''rubygems'' > require ''wx'' > > app = Wx::App.new > frame = Wx::Frame.new( nil , -1 , "MiniApp" ) > #grid = Wx::Grid.new( frame , 2000, Wx::DEFAULT_POSITION, > Wx::DEFAULT_SIZE, Wx::WANTS_CHARS,"this the panel name" ) > tgrid = Wx::Grid.new(frame, -1) > tgrid.create_grid( 19 , 16 ) > frame.show() > app.main_loop() > > --------- > > Any help would be appreciated I have to get a little utility running > on my mac and a windows machine before the 18th. > > Sincerely, > Hawley > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >
Hawley Waldman
2007-Jan-04 14:14 UTC
[Wxruby-users] grid control example doesn''t work on osx.4
Hi Alex, Thanks for explaining the problem. Doing things from within on_init took care of the problem. The project that I''m using this for is just a small display type program(read hack) so, now that I understand why the simplest of things was bombing I can put in a few hours to get things working on my mac and then test it on a windows machine. I''d like to be able to stick with wxRuby because of it''s use of native widgets. thanks again, Hawley> Hi Hawley > > >> I am trying to use wxruby2-preview (0.0.38) on my intel macbook >> running os10.4.8. I am having a beast of a time running the examples >> in the tutorials. >> > Apologies, it appears no-one has reviewed the code in the wiki > tutorials > for some time, and they have got out of date. Suggest you refer to the > samples supplied with wxruby2-preview in preference. > >> The code is below, line 10 is the call to tgrid = Wx::Grid.new(frame, >> -1), what the heck am I missing? >> > The tutorial and the example you give are trying to create widgets > (Frames, Grids) outside of the on_init loop of you App. This will > definitely cause the kind of problems you''re seeing. Try structuring > your code like this: > > require ''wx'' > > class GridApp < Wx::App > def on_init > frame = Wx::Frame.new(nil, -1, "Grid wxRuby App") > grid = Wx::Grid.new(frame, -1) > grid.create_grid(5, 5) > frame.show() > end > end > > GridApp.new.main_loop