I have skimmed through my books, I have looked online for tutorials, and
I have searched Amazon for other books. I cannot find anything on
TK/Ruby that makes any sense. Or very much information either. It’s
really hindering me, because I don’t know how to use GTK, but TK is
installed automatically with Ruby. I really don’t need much complexity,
as just basic codes.
Does anyone know of a book, a website, a help file, a PDF, anything…
anything at all… that clearly describes how to use TK with Ruby? Any
advice is appreciated.
Sorry, I don’t know tk, but perhaps you can try my program, visualruby:
You can do a great deal without having to know GTK. It is written in
GTK, and if you get deeper into it, you will need to use the GTK
classes, but there is extensive documentation here:
Visualruby will make creating a GTK program much easier. And there are
lots of examples.
Most languages, which use a Tk interface, assume that the programmer
“knows Tk already and just wants to have it accessible from his favorite
language”. This applies to the Tk bindings not only for Ruby, but also
Perl, Python and so on.
This could give you a starting point, and you will get a feeling on how
Tk is mapped to Ruby. I think most people start with such introductions,
and once they get a feeling on how the mapping was done, use then the
original Tk documentation as a reference.
I actually tried to install Visual Ruby, but could not get it to work. I
also have Glade GTK 2. I could not find a version for GTK 3, and I have
done extensive searching.
Part of my problem with TK is that the code has to be modified to go
with Ruby, and I don’t know all the modifications.
visualruby works great with gtk3. I’ve updated it several times lately.
If you go to visualruby.net, there are download instructions. If you
have any problems, just let me know. As far as I know it works on all
platforms.
It works on windows too, but I personally use linux simply because
I can be much more productive when writing code. (Ruby makes windows
less annoying though, and bash is available in the latest windows
too by default as far as I am aware + ubuntu or something like
that.)
The second link is a wiki, it is quite helpful although lagging
a bit behind in documentation. See the official gtk3 page,
developer API documentation if you need help.
There is an example with the download for ruby-gnome, called
misc.rb or so, have a look in the directory after downloading
it. It showcases what ruby-gnome can do or ruby-gtk respectively,
also gtk2 btw; gtk3 should work fine too.
The examples all comes with the source code. If you know a bit
about ruby tweaking things to your working will be very very
easy eventually.