Tk load error

T

Teodor Carstea

Hi all! I start using Tk to create Ruby GUI apps but that's da error:

diabolator2@book:~$ cd /home/cristi/Desktop
diabolator2@book:~/Desktop$ ruby firsttk.rb
firsttk.rb:1:in `require': no such file to load -- tk (LoadError)
from firsttk.rb:1
diabolator2@book:~/Desktop$

I tried to reinstall Tk but it was ok:

diabolator2@book:~$ sudo apt-get install tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
tk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

what's up?
Thanks!
 
A

Axel

Do you have the Ruby-Tk-binding installed?

I think, you should have something like:
....\lib\ruby\site_ruby\1.8\tk
and
....\lib\ruby\site_ruby\1.8\tkextlib
in your Ruby-dir.

Which Ruby-Version are you using?

Axel
 
T

Teodor Carstea

Do you have the Ruby-Tk-binding installed?
well, as I know, Tk and Tk binding are different things. I dunno if I
have it, at least how to check for it.
I think, you should have something like:
....\lib\ruby\site_ruby\1.8\tk
and
....\lib\ruby\site_ruby\1.8\tkextlib
in your Ruby-dir.
no, I haven't. BUT:
diabolator2@book:~$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
and.... :
diabolator2@book:~$ apt-cache show ruby | grep Version
Version: 4.2
Which Ruby-Version are you using?
I don't know which of the commands above actually gives me the version
of my apps. I also studied the link below, but I'm a little bit "green"
tu get through all of that... Any ideeas?

by the way, "which ruby" gives me usr/bin/ruby, I cd to that location
and found "ruby1.8", an executable file, plus "ruby" - link to ruby1.8.
which tk gives nothing and tk -v gives bad command.
 
P

Phillip Gawlowski

well, as I know, Tk and Tk binding are different things. I dunno if I
have it, at least how to check for it.

It's probably a package called "ruby-tk", or "libtk-ruby", or similar.

Checking my Ubuntu VM (anything based off of Debian or Ubuntu should be
similar, with other distros being similar), I find that
"apt-cache search ruby tk" yields

"libtcltk-ruby1.8 - Tcl/Tk interface for Ruby 1.8"
which is probably what you need. :)
I don't know which of the commands above actually gives me the version
of my apps. I also studied the link below, but I'm a little bit "green"
tu get through all of that... Any ideeas?

"ruby -v" gives you the actual Ruby version, while apt-get's version is
the version of the package your distro provides. Clear as mud? :p
 
T

Teodor Carstea

I've installed libtcltk-ruby and everything runs well until I require
'tkextlib/tile', and get error:

/usr/lib/ruby/1.8/tk/package.rb:86:in `require': TkPackage can't find
package tile (RuntimeError)
from /usr/lib/ruby/1.8/tkextlib/tile.rb:24
from converter.rb:2:in `require'
from converter.rb:2

The program looks like

require 'tk'
require 'tkextlib/tile'
root = TkRoot.new {title ....
bla bla bla
bla bla...whatever..
Tk.mainloop

I guess, I need some more packages or what?
 
A

Axel

/usr/lib/ruby/1.8/tk/package.rb:86:in `require': TkPackage can't find
package tile (RuntimeError)

I think, TCL/TK is missing "Tile".
Try to install it with "teacup" (similar to gem for Ruby)

teacup search tile
(not case sensitive)

teacup install tile
(case sensitive)

Axel
 

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,776
Messages
2,569,603
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top