Forum: Ruby installing Tk for Ruby on OS X

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
94e31fd5108ef7932267dfc94412b668?d=identicon&s=25 unknown (Guest)
on 2006-02-19 03:55
(Received via mailing list)
Hi,

I tried to run the one line script tk.rb

require 'tk'

and saw the following error

$ ruby tk.rb
/usr/local/lib/ruby/1.8/tk.rb:7:in `require': No such file to load --
tcltklib (LoadError)
        from /usr/local/lib/ruby/1.8/tk.rb:7
        from tk.rb:1:in `require'
        from tk.rb:1

I don't know if it matters but I can run the following command without
error

$ tclsh
%

What do I do? Do I install tk as a gem?

Thanks,
Peter
94e31fd5108ef7932267dfc94412b668?d=identicon&s=25 unknown (Guest)
on 2006-02-19 03:58
(Received via mailing list)
I found this site

http://tcltkaqua.sourceforge.net/

but I don't want to use tk that is specific to aqua. I want to make a
portable gui (Windows, Linux, OS X, ...)
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 Tsume (Guest)
on 2006-02-19 04:44
(Received via mailing list)
On Sun, 2006-02-19 at 11:58 +0900, petermichaux@yahoo.com wrote:
> I found this site
>
> http://tcltkaqua.sourceforge.net/
>
> but I don't want to use tk that is specific to aqua. I want to make a
> portable gui (Windows, Linux, OS X, ...)
>
>

I've not used TclTkAqua, but doesn't the Tk interface just wrap the
widgets around the native MacOSX widget set? So it would be okay to
create an application for Tk, and use it on other platforms.

Also, In other recent threads, you might want to check out

http://tktable.sourceforge.net/tile/
Latest Ruby 1.8.4 contains a method to wrap the Tk API to Tile widgets,
see the thread located at

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/...
Skip ahead of the GTK/2 talk and read the Tk portion

Tsume
94e31fd5108ef7932267dfc94412b668?d=identicon&s=25 unknown (Guest)
on 2006-02-19 05:05
(Received via mailing list)
I'm having trouble using even this apparently easy to use tk aqua
binary. Arg. Shouldn't using Tk be extreamly easy in the Ruby world? Is
there a catch?
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-02-19 05:38
(Received via mailing list)
On Feb 18, 2006, at 11:03 PM, petermichaux@yahoo.com wrote:

> I'm having trouble using even this apparently easy to use tk aqua
> binary. Arg. Shouldn't using Tk be extreamly easy in the Ruby
> world? Is
> there a catch?
>
>

The catch is that the magic Aqua Tk works very well with the Apple
installed ruby. I don't know how hard it is to get it to work in a
self compiled ruby. The default tk with the source ruby distribution
wants an X server running and doesn't look native
Cfa80d65597d3e43664c762cbb715e38?d=identicon&s=25 Gaz Bulmer (gbulmer)
on 2006-02-19 14:49
(Received via mailing list)
petermichaux@yahoo.com wrote:
> tcltklib (LoadError)
>         from /usr/local/lib/ruby/1.8/tk.rb:7
>         from tk.rb:1:in `require'
>         from tk.rb:1
>
Obviously Ruby's Tk wrapper isn't finding the library.
Did you install Ruby on the Mac yourself?
Which version of Mac OS X have you?

> I don't know if it matters but I can run the following command without
> error
>
> $ tclsh
> %
>
> What do I do? Do I install tk as a gem?
>
First try the Tcl shell with Tk built in, it's called 'wish'.

Paste this into wish (or put it in a file e.g. called 'hello', and
execute 'wish hello'):
button .b -text "Hello, world!" -command exit
pack .b

You should get a small window with a 'Hello, world" button.

On my Mac OS X 10.4, the pre-installed Ruby works with Tk (which is
also installed), so ...

Can you revert to the version that came pre-installed on the Mac
(/usr/bin/ruby) and try the little 'hello world' example? That will
tell you if you have the right pieces installed, and if Tk is able to
cooperate.

This may be good enough for now, but if not, the build method
recommended by the Ruby on Rails book is at:
http://tech.rufy.com/articles/2005/05/01/complete-...

I haven't tried that yet, but will will later today (I may need to use
different versions of Ruby for a project).

HTH GB-)
This topic is locked and can not be replied to.