Using [incr Widgets] in Ruby/Tk on OS X

  • Thread starter Morton Goldberg
  • Start date
M

Morton Goldberg

I'm using Ruby 1.8.2 on Mac OS X 10.4.7. I discovered the Ruby
distribution included a directory supporting [incr Widgets]. Some of
them seemed pretty nifty, so I thought I'd try them out. My first try
was to make an "instant" calendar with the Calendar widget. After a
bit of fooling around I got a calendar up on my screen, but one of
things I had to do to make it work bothers me.

The [incr Widgets] support files live in /usr/lib/ruby/1.8/tkextlib/
iwidgets/. There is a file, /usr/lib/ruby/1.8/tkextlib/iwidgets.rb,
that autoloads the iwidget classes. However, the iwidgets.rb is is
coded with lines like

autoload :Calendar, 'tkextlib/iwidgets/calendar'

which means iwidgets.rb has to be one directory level up (in /usr/lib/
ruby/1.8/) to work. So I put a copy of iwidgets.rb in in /usr/lib/
ruby/1.8/. With that hack, "require 'iwidgets'" works -- at least in
the short term. But what will happen if Apple installs a newer
version of Ruby as part of an OS X update? Is there a better way to
fix this sort of problem?

Regards, Morton
 
H

Hidetoshi NAGAI

From: Morton Goldberg <[email protected]>
Subject: Using [incr Widgets] in Ruby/Tk on OS X
Date: Fri, 1 Sep 2006 11:43:09 +0900
Message-ID: said:
which means iwidgets.rb has to be one directory level up (in /usr/lib/
ruby/1.8/) to work. So I put a copy of iwidgets.rb in in /usr/lib/
ruby/1.8/. With that hack, "require 'iwidgets'" works -- at least in

Please use "require 'tkextlib/iwidgets'".
It will load "tkextlib/iwidgets.rb".
 
M

Morton Goldberg

Thanks very much. That's what I needed to know. I don't know why I
didn't think of it myself, but I didn't.

Regards, Morton

From: Morton Goldberg <[email protected]>
Subject: Using [incr Widgets] in Ruby/Tk on OS X
Date: Fri, 1 Sep 2006 11:43:09 +0900
Message-ID: said:
which means iwidgets.rb has to be one directory level up (in /usr/
lib/
ruby/1.8/) to work. So I put a copy of iwidgets.rb in in /usr/lib/
ruby/1.8/. With that hack, "require 'iwidgets'" works -- at least in

Please use "require 'tkextlib/iwidgets'".
It will load "tkextlib/iwidgets.rb".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top