Ruby TK. How to start using?

Question:

I am trying to make an example from the book in which I need to connect tk, but it gives the following:

/home/matt/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file – tk (LoadError ) from /home/matt/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in 'require' from p001hello.rb: 1: in ''

Here is the code, nothing special. It is clear that this is exactly the point (extension, I don’t know how it’s called correctly):

require 'tk'

hello = TkRoot.new
TkLabel.new(hello) do
  text "\n Hello, Matz! \n"
  pack
end
Tk.mainloop

Answer:

Try this:

gem install tk
Scroll to Top