Forum: Ruby How to enable Tk.Tile for ruby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-03 10:36
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
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-03 10:38
Sorry, the error is:
test.rb:6: uninitialized constant Tile (NameError)
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2008-04-03 11:17
(Received via mailing list)
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.
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-03 12:57
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?
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2008-04-03 19:16
(Received via mailing list)
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.
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-18 16:57
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
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-23 14:23
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.
46da6bf7c3054c04347ac0cc22fbd67e?d=identicon&s=25 Nop Nop (nop)
on 2008-04-23 14:25
Sorry, I've forgotten:

before executing the script set also the variable:
>set %RUBYPATH%=c:\ruby19
This topic is locked and can not be replied to.