How to enable Tk.Tile for ruby?

N

Nop Nopovich

Hello gents,

I've got a standard ruby instalation (1.8.6) and ActiveState Tcl/Tk 8.4
and 8.5 on Windows XP. What I need is to enable Tile widgets. How to
access them from ruby? It seems like the ruby doesn't know anything
about Tile.

pkg_checker.rb produces the following:

Ready : tile.rb : require->{"tile"=>"0.8.2"}
Ready : tile/dialog.rb : require->{}
Ready : tile/setup.rb : require->{}
Ready : tile/sizegrip.rb : require->{}
...

Actually I don't know how to understand that but looks like the TK 8.5
distribution is OK.

Then I run the following code:

require 'tk'
require 'tkextlib/tile'

root = TkRoot.new { title "Ex1" }

Tile.TkButton.new(root) {
text "Ok"
command proc { print "Hello, World!"; exit }
pack('side'=>'left', 'padx'=>10, 'pady'=>10)
}

Tk.mainloop()

The error is:
test.rb:6: uninitialized constant TileButton (NameError)

So the question is: does anyone know how to enable Tile in my Ruby/Tk
code?

Thanks in advance,
Nop
 
H

Hidetoshi NAGAI

From: Nop Nopovich <[email protected]>
Subject: How to enable Tk.Tile for ruby?
Date: Thu, 3 Apr 2008 17:37:02 +0900
Message-ID: said:
Tile.TkButton.new(root) {
---------------------------------------
Tk::Tile::Button.new(root) {
---------------------------------------

Probably it works.
However, I recommend you to use the latest version of
Ruby/Tk (please get it from SVN) with tile 0.8.2.
You may have some troubles, because Ruby/Tk on Ruby1.8.6
supports tile 0.7.x.
 
N

Nop Nop

Hidetoshi said:
From: Nop Nopovich <[email protected]>
Subject: How to enable Tk.Tile for ruby?
Date: Thu, 3 Apr 2008 17:37:02 +0900

---------------------------------------
Tk::Tile::Button.new(root) {
---------------------------------------

Probably it works.
However, I recommend you to use the latest version of
Ruby/Tk (please get it from SVN) with tile 0.8.2.
You may have some troubles, because Ruby/Tk on Ruby1.8.6
supports tile 0.7.x.

OK, that might be. To be honest, it's a big deal to build the latest
ruby snapshot on windows. So I've just downloaded the latest 1.9 binary
release. It's 25.12.2007 and ActiveTCL 8.5 had released on 20.12.2007.
So it seems like that's OK?

But I couldn't even make the 1.9 ruby release to work with TK, even 8.4.
I've got the error whil running some simple ruby/Tk code:

Tk::Root::TkRoot (NameError)
from C:/ruby19/lib/ruby/1.9.0/tk/root.rb:8:in `<top (required)>'
from test.rb:4:in `<main>'

Why could be that?
 
H

Hidetoshi NAGAI

From: Nop Nop <[email protected]>
Subject: Re: How to enable Tk.Tile for ruby?
Date: Thu, 3 Apr 2008 19:58:02 +0900
Message-ID: said:
OK, that might be. To be honest, it's a big deal to build the latest
ruby snapshot on windows. So I've just downloaded the latest 1.9 binary
release. It's 25.12.2007 and ActiveTCL 8.5 had released on 20.12.2007.
So it seems like that's OK?

It's not a latest version. I said "please get it from SVN".
Please see [ruby-talk:296196] and [ruby-talk:296361].

# The bug decscibed on [ruby-talk:296361] is already fixed on
# my working copy. But still not committed.
 
N

Nop Nop

Hidetoshi said:
It's not a latest version. I said "please get it from SVN".
Please see [ruby-talk:296196] and [ruby-talk:296361].

# The bug decscibed on [ruby-talk:296361] is already fixed on
# my working copy. But still not committed.

Hello,

I've just built ruby 1.9 (revision 16072) from svn. But it looks like
there is no TK support in the resulting package. That means that I need
to somehow enable Tk support while building ruby. Could you please
explain how to enable it?

Thanks in advance,
Nop
 
N

Nop Nop

Hello all,

Finally i did it, hoooray! Special thanks to Hidetoshi Nagai for his
assistance!

Now I'll describe briefly how to build ruby 1.9 for Windows (win32) and
enable Tk 8.5 and Tile support.

1. Check if the last ActiveTcl distribution is installed (c:\tcl).
2. Get the gnuwin32 utils (at least bison and sed are needed, but I've
installed the whole package. If you will install the whole batch of
gnuwin32 utils then bear in mind that you have to remove the "find"
utility. There is something wrong with it).
3. Get the latest ruby1.8 installer and install it.
4. Install MSVC++ or whatever.
5. Open console.
6.If you've installed MS Visual Studio then find vsvars32.bat file and
execute it. It will set the variables, and you can check that everything
is ok by typing "nmake --version"
7. %PATH% should also point to the gnuwin32\bin, ruby18\bin, tcl\bin
%LIB% should also point to tcl\lib
%LIBPATH% should also point to tcl\bin
%INCLUDE% should also point to tcl\include

Set this variables accurately! For instance:
set INCLUDE=c:\tcl\include;%INCLUDE%

8. Go to your ruby source and perform the commands:
win32\configure.bat --prefix=c:\ruby19
nmake
nmake install

9. When everything is ok you may test your distribution as following:
a) open console
b) set variables
set PATH=c:\ruby19\bin;%PATH%
set LIBPATH=c:\ruby19\bin;c:\tcl\bin;%LIBPATH%
c) run the following script:

require 'tk'
require 'tkextlib/tile'

root = TkRoot.new { title "Ex1" }

Tk::Tile::Button.new(root) {
text "Ok"
command proc { print "Hello, World!"; exit }
pack('side'=>'left', 'padx'=>10, 'pady'=>10)
}

Tk.mainloop()

It should show you the Tk/Tile button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top