I'm working through the 'picturebook.rb' example in "FXRuby Create Lean
and Mean GUIs with Ruby" and got stuck embarrassingly early in the book.
I'm good up to the point that a blank window pops up (p 28). When I
proceed to add the other classes (p 30), errors result. The program
runs fine as shown, but when the commented lines are uncommented an
error message is shown (below).
Code that replicates p 30 with four lines commented out:
require 'fox16'
include Fox
#require 'photo'
#require 'photo_view'
class PictureBook < FXMainWindow
def initialize(app)
super(app, "Picture Book", :width => 600, :height => 400)
#photo = Photo.new("bridge damage10.jpg")
#photo_view = PhotoView.new(self, photo)
end
def create
super
show(PLACEMENT_SCREEN)
end
end
if __FILE__ == $0
FXApp.new do |app|
PictureBook.new(app)
app.create
app.run
end
end
Error message:
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
'gem_original_require': no such file to load -- photo (LoadError)
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: in
'require'
from C:/Ruby/myscripts/picturebook/picturebook.rb:5
It seems like the fix would be to path the files so FXRuby can find
them, but I don't know what path that would be?
Thanks,
Jessica
on 2010-01-22 01:28
on 2010-01-27 18:43
After reading 7.6 in "The Ruby Programming Language" I know what path is searched first. I was running the program with an absolute path, so the other files were not found. Now I'm getting a different error: C:/Ruby/lib/ruby/site_ruby/1.8/fox16/kwargs.rb:1193:in 'old_initialize': wrong argument type Photo (expected Data) (TypeError) The error output continues.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.