Cannot find GUI? TK Toolkit?

Hi there! I’m Todd. It’s nice to meet you all.

I recently began coding in Ruby and have no previous programming
experience. I have a couple books, and one talks about using a GUI for
rb files. But I can’t find an installation of TK Toolkit, which is
supposed to allow you to use a GUI with Ruby. I’ve been to ActiveState
and all it does is give me a download of Perl or something that has to
do with it. I’ve also been searching on Google and get nothing relevant.

I’m very confused and don’t know what to do. I’m not completely new to
Ruby, as I just finished a beginner’s book called Learning R. from
O’Reilly. But I’m still starting out. Any help please? I really need to
figure out how to use a GUI with Ruby.

I don’t have any experience with it, but Visual Ruby 3 was announced
here a few days ago.

https://www.ruby-forum.com/topic/6878691

Hello Todd,

What operating system are you using? If you’re using linux or a mac you
should be able to install the tk library via your package manager.

That should be all you have to do, as tk is part of the ruby std
library.

If you’re using windows then there is a gem tk-win, but I have never
used it.

Thank you! If it had not been for your comment, I would not have
realized that I could install TK Toolkit with the Ruby Installer for
Windows. I went to install Ruby 2.3.0 because that’s what was required
for use with Visual Ruby 3, when I noticed that I could easily install
TK by simply checking the option on the installation window. I’m still
new to Ruby, so I missed the option the first time that I installed
Ruby.

Okay, I liked the concept of Visual Ruby, so I decided to install it. I
did everything that the installation instructions said, except I could
find no conventional installer for Glade/GTK+3. There was something
about Windows Binaries and so I installed the latest file from there,
and it says that it is GTK+2. So now I can run Glade on my computer, but
I think it may be an earlier version.

However, I am still horribly lost. I installed Visual Ruby and the
installation appeared to be successful. But after having problems
getting it to work, I tried to install a couple of other gems that were
referenced in this forum as possible solutions, yet I still get nothing
more than errors.

It says that I may have encountered a bug in the Ruby interpreter or
extension libraries. Then after that it says that this application has
requested the Runtime to terminate it in an unusual way. Plus there were
tons and tons of error messages I didn’t understand and I couldn’t copy
and paste them.

So, yes, this beginner is very confused. :frowning:

Any help for this? I figure it’s still on topic since the topic is about
GUI’s for Ruby.

Any help for this? I figure it’s still on topic since the topic
is about GUI’s for Ruby.

Hello.

I can not help you with your above particular question.

However had, I personally use ruby-gnome and ruby-gtk. There are also
bindings for gtk3 which sort of work but I have not tested them
extensively.

Last year I started to push in my old custom code into a gem - you can
find some enhancements perhaps to the default ruby-gtk stuff here:

https://rubygems.org/gems/gtk_module

It is not really super-documented, so it may be best to just look at the
source and see whether you can use something.

The ruby-gnome bindings can be downloaded here:

https://ruby-gnome2.osdn.jp/hiki.cgi

Try to install it and get the hello world example working.

Once it is working, I recommend you look at the gtk2 and gtk3
subdirectory; look for the samples and examples, in particular in file
main.rb but also in other files.

There is a big menu that you can run and if you double click on a
widget, the ruby source will also be shown.

About 400 or 500 .rb files examples are there and the wiki is, although
not super pretty, useable. No other GUI in ruby has such a wiki in the
first place.

I highly recommend to use ruby-gnome or ruby-gtk. Try to keep things
just simple. It will work when you stick to the simple stuff.

kou is the current main maintainer - he is very active as you can see,
last commit 2 hours ago:

https://github.com/ruby-gnome2/ruby-gnome2

He always welcomes contributors too! Last but not least, gtk looks
prettier than tk, so there is that. :slight_smile: (ruby-qt is also ok from the
looks but I found that even less people use it than ruby-gnome and they
have no wiki.)