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.
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.
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?
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