Ruby :: Tk lib is missing

Posted by PunNeng, Wed Jul 26 00:19:00 UTC 2006

There is a little problem in Ruby 1.8.4 on Ubuntu 6.06. I want to create a simple widget for Ubuntu then I followed this guide.

  1
  2
  3
  4
  5
  6
  7
require 'tk'
root = TkRoot.new { title "Ex1" }
TkLabel.new(root) {
  text  'Hello, World!';
  pack  { padx 15 ; pady 15; side 'left' }
}
Tk.mainloop

Unfortunately, I got a problem like this

'require': No such file to load -- tk (LoadError) 

This mean Ruby can't find Tk library. Tk library supposed to be in Ruby home but it disappeared.

The easy way I've found to fix it:

sudo apt-get install libtk-ruby

If you're Windows user, you're lucky. Tk lib works well on Windows, Just install Ruby.

Ubuntu

Windows

Have fun

Filed Under: Ruby | Tags: howto installing ruby tk

Comments

Have your say

A name is required. You may use HTML in your comments.




codegent: we're hiring