[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to enable Tk.Tile for ruby?

Nop Nopovich

4/3/2008 8:37:00 AM

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
--
Posted via http://www.ruby-....

7 Answers

Nop Nopovich

4/3/2008 8:39:00 AM

0

Sorry, the error is:
test.rb:6: uninitialized constant Tile (NameError)
--
Posted via http://www.ruby-....

Hidetoshi NAGAI

4/3/2008 9:17:00 AM

0

From: Nop Nopovich <nop@list.ru>
Subject: How to enable Tk.Tile for ruby?
Date: Thu, 3 Apr 2008 17:37:02 +0900
Message-ID: <b6bb309989f2f32dd2d0a64d24c048fe@ruby-forum.com>
> 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.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Nop Nopovich

4/3/2008 10:58:00 AM

0

Hidetoshi NAGAI wrote:
> From: Nop Nopovich <nop@list.ru>
> Subject: How to enable Tk.Tile for ruby?
> Date: Thu, 3 Apr 2008 17:37:02 +0900
> Message-ID: <b6bb309989f2f32dd2d0a64d24c048fe@ruby-forum.com>
>> 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.

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?
--
Posted via http://www.ruby-....

Hidetoshi NAGAI

4/3/2008 5:16:00 PM

0

From: Nop Nop <nop@list.ru>
Subject: Re: How to enable Tk.Tile for ruby?
Date: Thu, 3 Apr 2008 19:58:02 +0900
Message-ID: <328ae8297f9d2e609ad83de69e1dc247@ruby-forum.com>
> 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.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Nop Nopovich

4/18/2008 2:58:00 PM

0

Hidetoshi NAGAI wrote:
> 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
--
Posted via http://www.ruby-....

Nop Nopovich

4/23/2008 12:24:00 PM

0

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.
--
Posted via http://www.ruby-....

Nop Nopovich

4/23/2008 12:26:00 PM

0

Sorry, I've forgotten:

before executing the script set also the variable:
>set %RUBYPATH%=c:\ruby19
--
Posted via http://www.ruby-....