Which GEM to instal for TK?

I have Ruby 1.8.6 and gem 1.3.4 both on SUSE Linux and on Mac OSX 10.4
(Tiger). Both seemingly don’t have the ‘tk’ module:

require ‘tk’
LoadError: no such file to load – tk

Which gem do I need to install for getting Tk? I tried

gem install tk

but no such gem was found.

I haven’t used this in several years, but the tk_as_gem gem used to work
to
add Tk to an existing Ruby.

(It would be advisable to just upgrade to a newer Ruby; they general
have
Tk included.)

I got it from the Fedora repository, perhaps you may also get it from
the Suse repository.
The package name was ruby-tcltk-1.8.6…
Hope this help.

Am 29.10.2013 16:35, schrieb Ronald F.:

I have Ruby 1.8.6 and gem 1.3.4 both on SUSE Linux and on Mac OSX 10.4
(Tiger). Both seemingly don’t have the ‘tk’ module:

On a side note: 1.8.6 is really outdated, and unless you have
a very good reason you shouldn’t use it anymore and switch to 1.9.3
or 2.0.0. (Even 1.8.7 is not longer supported by the Ruby core team.)

require ‘tk’
LoadError: no such file to load – tk

Which gem do I need to install for getting Tk? I tried

gem install tk

but no such gem was found.

On Ubuntu, there is a libtcltk-ruby package, there might be something
similar for SuSE.

Regards,
Marcus

unknown wrote in post #1126034:

Am 29.10.2013 16:35, schrieb Ronald F.:

I have Ruby 1.8.6 and gem 1.3.4 both on SUSE Linux and on Mac OSX 10.4
(Tiger). Both seemingly don’t have the ‘tk’ module:

On a side note: 1.8.6 is really outdated, and unless you have
a very good reason you shouldn’t use it anymore and switch to 1.9.3
or 2.0.0. (Even 1.8.7 is not longer supported by the Ruby core team.)

I would like to switch too, but from what I know, the later versions
don’t run on OSX 10.4.

Maybe they can be ported, but the one-click installer (which is very
convenient to use) only offers 1.8.6 for this platform.

Ronald

Eric C. wrote in post #1126028:

I haven’t used this in several years, but the tk_as_gem gem used to work
to
add Tk to an existing Ruby.

Indeed, the gem exists, but installation fails:

tcltklib.c: In function ‘lib_eventloop_core’:
tcltklib.c:1995: error: ‘CHECK_INTS’ undeclared (first use in this
function)

(same error on Linux and Mac). Seems that the implementation is broken.
The code part in question looks a bit like unfinished work:

#ifdef RUBY_USE_NATIVE_THREAD
/* if (update_flag == 0) CHECK_INTS; */ /*XXXXXXXXXXXXX TODO
!!! */
#else
if (update_flag == 0) CHECK_INTS;
#endif

Actually, CHECK_INTS isn’t defined anywhere, so I guess tests had been
usually done with RUBY_USE_NATIVE_THREAD being set and the error did not
show up.

I wonder whether it is safe to just remove this section from the code.
Or should I for the safe side contact the supporters of this gem?

Am 30.10.2013 10:42, schrieb Ronald F.:

don’t run on OSX 10.4.

Maybe they can be ported, but the one-click installer (which is very
convenient to use) only offers 1.8.6 for this platform.

Ronald

I do not really know anything about OS X, but I’m pretty sure
newer versions should work. I guess commonly used tools like RVM
or homebrew(?) might help.

Regards,
Marcus

On 10/29/2013 08:35 AM, Ronald F. wrote:

but no such gem was found.

Maybe you should try ActiveTk:

There may be a version old enough for you.

-Justin

unknown wrote in post #1126077:

Am 30.10.2013 10:42, schrieb Ronald F.:

don’t run on OSX 10.4.

Maybe they can be ported, but the one-click installer (which is very
convenient to use) only offers 1.8.6 for this platform.

Ronald

I do not really know anything about OS X, but I’m pretty sure
newer versions should work. I guess commonly used tools like RVM
or homebrew(?) might help.

Homebrew unfortunately doesn’t run on OSX 10.4.

As for rvm, I don’t know yet whether it will work, but getting it
running, will be a non-trivial effort. I would have to install a newer
bash version first, which is required by rvm, and also git and
subversion, and with all of this, it is not clear whether I can find a
version which is new enough for rvm, but still supported on my OSX.

Ronald

On 10/30/2013 02:32 PM, Ronald F. wrote:

year).

BTW, I don’t think that the problem is a missing Tk version on my
systems. On the Mac, I can happily use Python with tkinter (which is
their Tk binding), and on my Linux system I can run wish. The problem is
the interface from Ruby to Tk.

Oh then you should check out http://rdoc.info/stdlib/tk/

You might just need to adjust the Tk load path Ruby uses.

-Justin

Justin C. wrote in post #1126116:

On 10/29/2013 08:35 AM, Ronald F. wrote:
Maybe you should try ActiveTk:
Download & Install Tcl | ActiveState

There may be a version old enough for you.

There might be, but not free. ActiveState has the interesting price
policy, that they hand out the newer versions for free, but for the
older versions we have to pay a pretty steep price (999 US$ per user per
year).

BTW, I don’t think that the problem is a missing Tk version on my
systems. On the Mac, I can happily use Python with tkinter (which is
their Tk binding), and on my Linux system I can run wish. The problem is
the interface from Ruby to Tk.