Forum: Ruby Tk on Windows and Mac OS X 10.6

Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (Guest)
on 2010-02-16 22:34
(Received via mailing list)
Is it possible to install Ruby Tk bindings on Windows with
RubyInstaller, and on Mac OS X 10.6, without recompiling Ruby? I've
seen a few sites that explain how to recompile Ruby on each platform
to use Tk, but so far it looks like that's the only way.
699c00ad35f2755810b4aa5f423d73e2?d=identicon&s=25 Albert Schlef (alby)
on 2010-02-17 00:57
Eric Christopherson wrote:
> Is it possible to install Ruby Tk bindings on Windows with
> RubyInstaller, and on Mac OS X 10.6, without recompiling Ruby?


I'm not sure about MaxOSX, but for Windows:

  http://wiki.github.com/rdp/ruby_tutorials_core/tk

The "Availability" section says you just have to install ActiveState's
package and everything will work fine.
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (Guest)
on 2010-02-17 01:16
(Received via mailing list)
On Tue, Feb 16, 2010 at 5:57 PM, Albert Schlef <albertschlef@gmail.com>
wrote:
> package and everything will work fine.
I did install ActiveTcl on Windows, but afterwards "require 'tk'"
didn't work. It seems that I don't even have the proper Ruby files to
"require". I also never told Ruby where my Tcl/Tk was installed.
699c00ad35f2755810b4aa5f423d73e2?d=identicon&s=25 Albert Schlef (alby)
on 2010-02-17 03:14
Eric Christopherson wrote:
> On Tue, Feb 16, 2010 at 5:57 PM, Albert Schlef <albertschlef@gmail.com>
> wrote:
>> package and everything will work fine.
> I did install ActiveTcl on Windows, but afterwards "require 'tk'"
> didn't work. It seems that I don't even have the proper Ruby files to
> "require". I also never told Ruby where my Tcl/Tk was installed.

I vaginally remember having this problem. After I installed
ActiveState's package ruby wasn't able to see Tk's DLL. I believe my
problem had gone after I restarted Windows. Perhaps the folder the DLL
is in is added to Windows' registry somewhere and Windows notes it only
after a restart. I know very little about Windows so this is only a
guess.
699c00ad35f2755810b4aa5f423d73e2?d=identicon&s=25 Albert Schlef (alby)
on 2010-02-17 03:18
Albert Schlef wrote:
> Eric Christopherson wrote:
>> On Tue, Feb 16, 2010 at 5:57 PM, Albert Schlef <albertschlef@gmail.com>
>> wrote:
>>> package and everything will work fine.
>> I did install ActiveTcl on Windows, but afterwards "require 'tk'"
>> didn't work. It seems that I don't even have the proper Ruby files to
>> "require". I also never told Ruby where my Tcl/Tk was installed.
>
> I vaginally remember having this problem.

Wow. I intended to write "vaguely". I had some misspelling ("vagually"),
so I just picked the first suggestion the speller gave me, it looked
like what I wanted. My sight isn't 6/6. Sorry :-)
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (Guest)
on 2010-02-17 06:25
(Received via mailing list)
On Tue, Feb 16, 2010 at 8:14 PM, Albert Schlef <albertschlef@gmail.com>
wrote:
> problem had gone after I restarted Windows. Perhaps the folder the DLL
> is in is added to Windows' registry somewhere and Windows notes it only
> after a restart. I know very little about Windows so this is only a
> guess.

I just installed ActiveTcl, on my home machine this time, and I don't
see any Ruby-specific files in its directory hierarchy. After
rebooting, requiring 'tk' again yielded "LoadError: no such file to
load -- tk", so I think I may be out of luck.
699c00ad35f2755810b4aa5f423d73e2?d=identicon&s=25 Albert Schlef (alby)
on 2010-02-17 07:14
Eric Christopherson wrote:
> I just installed ActiveTcl, on my home machine this time, and I don't
> see any Ruby-specific files in its directory hierarchy. After
> rebooting, requiring 'tk' again yielded "LoadError: no such file to
> load -- tk", so I think I may be out of luck.

I've just switched to my Windows box and tried to install Ruby + Tk.

Like you, I've found out that Ruby (of RubyInstaller) doesn't come with
some ruby files necessary to talk with Tk. E.g., it should have a file
C:\Ruby\lib\ruby\1.8\tk.rb (and some more, including a DLL) but it
doesn't have them.

It seems like a change in recent RubyInstallers, because I remember
easily installing Ruby+Tk on Windows in the past.

I'll try to investigate this.

Hidetoshi NAGAI, are you there? Do you know anything about this?
699c00ad35f2755810b4aa5f423d73e2?d=identicon&s=25 Albert Schlef (alby)
on 2010-02-17 07:30
Albert Schlef wrote:
> Like you, I've found out that Ruby (of RubyInstaller) doesn't come with
> some ruby files necessary to talk with Tk.
[...]
> It seems like a change in recent RubyInstallers, because I remember
> easily installing Ruby+Tk on Windows in the past.

It seems I've solved the mystery: "RubyInstaller" doesn't come with Tk
bindings, but Ruby's "One-Click Installer" does. So in the past it was
the latter I was using, not the former.

I'll shut up for a while and let more knowledgeable people than me join
this discussion.
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-17 09:42
(Received via mailing list)
Hi,

don't know about MAC; that's what I know for Windows:

You need to have:

* TCL/TK installed (for example, from Active State)
* The _right_ compiled Ruby-TK-Files
* Your ENV-Variable "path" set to the right paths

The Ruby-TK-Files depend on:
* TK-Version (8.4, 8.5; 8.5 probably looks nicer)
* Ruby version
* Compiler, with which Ruby has been complied.

AFAIK, it is sufficient to get the right ruby-files from "somewhere"
and copy them to the
right dirs in the Ruby dir.

I think, Roger Pack recently provided at least two versions of Ruby-
files, but now I can find only one:
* http://github.com/rdp/tk_as_gem

Maybe, you can find links to more here:
* http://groups.google.com/group/rubyinstaller/topics

If you want to compile it yourself with mingw:
* comp.lang.ruby, 2009-12-18, "Ruby 1.8.7 + Tk8.5 with Windows-
RubyInstaller"

If you want to compile it with Microsoft compiler (IMHO, this has
disadvantages regarding other libraries!):
* www.tkdocs.com

Axel
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-02-17 14:17
> I'm not sure about MaxOSX, but for Windows:
>
>   http://wiki.github.com/rdp/ruby_tutorials_core/tk
>
> The "Availability" section says you just have to install ActiveState's
> package and everything will work fine.

I've updated the windows section
http://wiki.github.com/rdp/ruby_tutorials_core/tk#windows
with a bit more verbosity on which version has it preinstalled.
-r
7ece60b3b5bb235d1b6df89727ca6cf7?d=identicon&s=25 mdiam (Guest)
on 2010-02-17 17:20
(Received via mailing list)
On 16 fév, 22:33, Eric Christopherson <echristopher...@gmail.com>
wrote:
> Is it possible to install RubyTkbindings on Windows with
> RubyInstaller, and on Mac OS X 10.6, without recompiling Ruby? I've
> seen a few sites that explain how to recompile Ruby on each platform
> to useTk, but so far it looks like that's the only way.

There is a project which could make use of Tk with ruby much easier :
    http://github.com/manveru/ffi-tk
It use ffi, so there is no specific binding to compile. You just need
to have the tcl/tk lib available.

  gem install ffi-tk

I'm not sure if this project is already usable, but it could be
**the**
solution for using Tk with Ruby?
It would be great if ffi-tk was afficialy supported by the ruby core.

-- Maurice
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-18 00:55
(Received via mailing list)
From: Albert Schlef <albertschlef@gmail.com>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Wed, 17 Feb 2010 15:14:28 +0900
Message-ID: <a34cd9fcc380dd4e3514bf66803d3837@ruby-forum.com>
> It seems like a change in recent RubyInstallers, because I remember
> easily installing Ruby+Tk on Windows in the past.
>
> I'll try to investigate this.
>
> Hidetoshi NAGAI, are you there? Do you know anything about this?

I don't know about recent RubyInstallers.

# A kind of troubles on OneClickRuby with ActiveTcl depends on
# the 'Path' environment variable which doesn't include bin (dll)
# folder of ActiveTcl.

I heard tcltklib doesn't work on MacRuby.
But I have no Mac box, and I don't know what kinds of trouble exist
on compiling or running on MacRuby.
So, at present, I cannot develop Ruby/Tk (tcltklib) on MacRuby.

For MacRuby (and JRuby), tk-ffi may be a kind of solutions.
I've thought about using FFI in the past.
And then, I didn't have good idea to treat properly (without C
functions) exceptions on callbacks without break Tcl's event queue.

BTW,
I know that there are many problems to install or distribute Ruby/Tk.
I have a plan to create tcltklib.so includeing a Tcl/Tk environment.
When using such kind of tcltklib.so, Ruby/Tk never load the Tcl/Tk
libraries on the local environment (it means, no need installed Tcl/Tk).
Although it may be a kind of advantage for some people, it loses the
function about easy update of Tcl/Tk libraries (includes using Tcl/Tk
extensions which are installed to local Tcl/Tk environment without
re-create tcltklib.so) working with Ruby/Tk.
Of course, we can make each version of tcltklib.so.

It is based on the idea of Tclkit (Starkit).
If I can, I may try also to write a VFS-like library accessing
directly Tcl's Mk4VFS from Ruby.
The library is used to create a monolitic executable file of Ruby/Tk
application on Windows and Linux (and so on?).
I know that it is a kind of "reinvention of the wheel".
However, I think, it's worth treating Ruby and Tcl/Tk files on one VFS.
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-18 13:31
(Received via mailing list)
> I know that there are many problems to install or distribute Ruby/Tk.
> I have a plan to create tcltklib.so includeing a Tcl/Tk environment.
> When using such kind of tcltklib.so, Ruby/Tk never load the Tcl/Tk
> libraries on the local environment (it means, no need installed Tcl/Tk).
> Although it may be a kind of advantage for some people, it loses the
> function about easy update of Tcl/Tk libraries (includes using Tcl/Tk
> extensions which are installed to local Tcl/Tk environment without
> re-create tcltklib.so) working with Ruby/Tk.

In advance, I was unhappy to need to install TCL (~ 23 MB), but
that was the only drawback. Installing ActiveTCL was without problems,
and as far as I understand, the licence is very permissive, even for
commercial use.  And I was glad to _easily_ be able to install
additional TCL-libraries via "teacup", for example "plotchart", which
enables me to easily plot simple graphs from within Ruby without
having to deal with gnuplot.

For MRI-Ruby (mingw) despite installing ActiveTCL, I think, you
need only to copy precompiled Ruby/TK-binaries into the right dirs and
set the PATH-variable to the right paths. You need not to compile it
yourself. Can anybody confirm this?

And, from the licences, would it be allowed to freely distibute these
binaries?

If all this is right, I think, it could be easy to install Ruby/TK on
Windows-MRI-mingw-Ruby; IMHO, there are only few things needed:

- A site for uploading and downloading precompiled binaries of Ruby/TK
  (or gem?)
  (Again, from the licences, would it be allowed to freely distibute
  these binaries?)
- A clear statement which binary is for which Ruby-version and
  TCL/TK-version (important).
- A clear description of how the install the downloaded
  Ruby/TK-binaries "copy files to xyz" (installer? gem? Roger Pack did
  something like this...)
- A statement that it is a drawback that you have to install
  AcitveState, but that it is the _only_ drawback and that it takes
  ~23 MB, that it's easy to install, that the licence is permissive
  even for professional use (true?) and that it has the advantage of
  enabling you to install additional packages, for example for
  plotting
- A short description of how to install additional TCL/TK packages
  using "teacup"
- A clear description on how to set the PATH-variable (or do it with
  an installer script?)

If my assumptions are right, I think with the above list it would be
easy to install Ruby/TK on Windows-mingw-MRI-Ruby.

Axel
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-18 15:25
(Received via mailing list)
From: Axel <a99.googlegroups.a99@dfgh.net>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Thu, 18 Feb 2010 21:30:16 +0900
Message-ID:
<1191f673-a6e5-4379-8d95-9e012665be3e@q16g2000yqq.googlegroups.com>
> In advance, I was unhappy to need to install TCL (~ 23 MB), but
> that was the only drawback. Installing ActiveTCL was without problems,
> and as far as I understand, the licence is very permissive, even for
> commercial use.  And I was glad to _easily_ be able to install
> additional TCL-libraries via "teacup", for example "plotchart", which
> enables me to easily plot simple graphs from within Ruby without
> having to deal with gnuplot.

On your environment only or machines under your control, it's no
problem.
As you say (me too), it is the best way to use Ruby (and Ruby/Tk).
However, if you must run your application on other environment
without proper version of Tcl/Tk, you may have some troubles.
I think that a monolithic tcltklib.so library is one of the solutions
to avoid such kind of troubles.
It doesn't replace current binary style of tcltklib.so on Ruby/Tk.
It is a new(?) binary style of tcltklib.so, which merges a Tcl/Tk
environment as a virtual file system.
When you load it on Ruby, you can use Ruby/Tk without installing Tcl/Tk.
It need not write files to the local disk excluding temporal DLL files
to load.

Probably, the tool will contain a base tcltklib.so library,
a work environment (a file tree), and commands for packing/unpacking.

# Maybe, I merge some codes to Ruby/Tk to support such feature.

When you want to use additional Tcl/Tk libraries,
you need copy the libraries to the work environment and pack it to
the "tcltklib.so" file.
To copy the libraries, you maybe able to use TEAcup.
And probably, you'll be able to test your application working with
the monolitic tcltklib.so by running it on the work environment.

# If it is available to pack Ruby binary and environment by similar
# way, we can get a single executable file include all environment.

> And, from the licences, would it be allowed to freely distibute these
> binaries?

Hmm..., I've not thought about the licenses.
Probably, it will depend on Tcl/Tk, Metakit, tclvfs, Tclkit (Starkit),
libraries packed with, and so on.

# I'm sorry, if my poor english cannot explain exactly.
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-18 16:13
(Received via mailing list)
> On your environment only or machines under your control, it's no problem.
> As you say (me too), it is the best way to use Ruby (and Ruby/Tk).
> However, if you must run your application on other environment
> without proper version of Tcl/Tk, you may have some troubles.

That's true. Would OCRA solve this problem?


> I think that a monolithic tcltklib.so library is one of the solutions
> to avoid such kind of troubles.
> ...
> # way, we can get a single executable file include all environment.

Sounds to me like a very good solution; but sounds like very difficult
and time-consuming, too.


> > And, from the licences, would it be allowed to freely distibute these
> > binaries?

I meant, for example, I've compiled Ruby/Tk with mingw, for a certain
version of Ruby and TK; would it be allowed to give these files to
everybody by download? Or, do you know, are there licence issues which
don't allow or restrict this?

Axel
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-18 23:57
(Received via mailing list)
From: Axel <a99.googlegroups.a99@dfgh.net>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Fri, 19 Feb 2010 00:12:08 +0900
Message-ID:
<e349167a-2928-448f-b330-410a968db43d@g26g2000yqn.googlegroups.com>
> That's true. Would OCRA solve this problem?

Maybe. My plan is not only one. It's one of the solutions.

> > I think that a monolithic tcltklib.so library is one of the solutions
> > to avoid such kind of troubles.
> > ...
> > # way, we can get a single executable file include all environment.
>
> Sounds to me like a very good solution; but sounds like very difficult
> and time-consuming, too.

Probably, not easy. But it will not so difficult as you think.
By using Tclkit and some experiments, I've already succeeded to make
a tcltklib.so merged a Tcl/Tk environment and create a TclTkIp object
with Tk (of course, the version of Tcl/Tk is the one of the merged) on
Ruby with the tcltklib.so.

> > > And, from the licences, would it be allowed to freely distibute these
> > > binaries?
> I meant, for example, I've compiled Ruby/Tk with mingw, for a certain
> version of Ruby and TK; would it be allowed to give these files to
> everybody by download? Or, do you know, are there licence issues which
> don't allow or restrict this?

Although I'm not well informed about licences, I think that you can
distribute the package or binary with the same restrict as the Tcl/Tk
package or binary created by Tclkit or Starkit.
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-19 08:20
(Received via mailing list)
> Probably, not easy. But it will not so difficult as you think.
> By using Tclkit and some experiments, I've already succeeded to make
> a tcltklib.so merged a Tcl/Tk environment and create a TclTkIp object
> with Tk (of course, the version of Tcl/Tk is the one of the merged) on
> Ruby with the tcltklib.so.

Great!

Thank you for your efforts!

Axel
7ece60b3b5bb235d1b6df89727ca6cf7?d=identicon&s=25 mdiam (Guest)
on 2010-02-19 10:50
(Received via mailing list)
On Feb 18, 11:56 pm, Hidetoshi NAGAI <na...@ai.kyutech.ac.jp> wrote:

> > > I think that a monolithic tcltklib.so library is one of the solutions
> > > to avoid such kind of troubles.
> > > ...
>
> Probably, not easy. But it will not so difficult as you think.
> By using Tclkit and some experiments, I've already succeeded to make
> a tcltklib.so merged a Tcl/Tk environment and create a TclTkIp object
> with Tk (of course, the version of Tcl/Tk is the one of the merged) on
> Ruby with the tcltklib.so.

Great, if it is possible, it would be *the* definitive solution for Tk
with Ruby.

If you have a recipe on how to build this full Ruby/Tk distrib from
sources, I could test it on Macosx and some linux.
These source would be :
- ruby-1.9xxx
- tcltk-8.5xxx or tcltk-8.6xxx

My idea would be to create a stand alone ruby sumo distrib (rubylab ?)
with  Ruby + Tk + Qt + FFI + some science selected extensions.
(This would be the last alternative before switching from Ruby to
Pihton :-( )

But as I'm not very clever in compilation, this will take some
time...

Cordialement,
-- Maurice
22d6eb88b1f537b5e1f953c73c0f2d24?d=identicon&s=25 saLOUt (Guest)
on 2010-02-19 15:30
(Received via mailing list)
On 19 Feb., 10:48, mdiam <maurice.diamant...@gmail.com> wrote:
> > Ruby with the tcltklib.so.
> My idea would be to create a stand alone ruby sumo distrib (rubylab ?)
> with  Ruby + Tk + Qt + FFI + some science selected extensions.
> (This would be the last alternative before switching from Ruby to
> Pihton :-( )
>
> But as I'm not very clever in compilation, this will take some
> time...
>
> Cordialement,
> -- Maurice

Didn't read everything. Just want to mention that there will be a Qt-
Ruby-Gem for Windows release very soon. For Linux there should be pre-
build packages available for most common distributions.

First adress for ruby + Qt/KDE: http://lists.kde.org/?l=kde-bindings

Robert
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-02-19 18:13
> If you have a recipe on how to build this full Ruby/Tk distrib from
> sources, I could test it on Macosx and some linux.
> These source would be :
> - ruby-1.9xxx
> - tcltk-8.5xxx or tcltk-8.6xxx
>
> My idea would be to create a stand alone ruby sumo distrib (rubylab ?)
> with  Ruby + Tk + Qt + FFI + some science selected extensions.
> (This would be the last alternative before switching from Ruby to
> Pihton :-( )

The only real cross platform distro I'm aware of is "rawr" for jruby.
If all you need is swing or the eclipse swt you're good to go (there's
examples of ruby wrapping the swt in the redcar project).
-r
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-20 08:16
(Received via mailing list)
> Maybe. My plan is not only one. It's one of the solutions.
>
> > > I think that a monolithic tcltklib.so library is one of the solutions
> > > to avoid such kind of troubles.
> > > ...
> > > # way, we can get a single executable file include all environment.

One more thought, on my feeling from what I read in this newsgroup
about Ruby/Tk on Windows:
_Until_ a very good solution is available, I think, it would be good
to have a clear description on how to install Ruby/Tk on Windows,
using for example ActiveTCL, and having binaries for download.
Something like Roger Pack provides, but even more.

Axel
7ece60b3b5bb235d1b6df89727ca6cf7?d=identicon&s=25 mdiam (Guest)
on 2010-02-20 11:11
(Received via mailing list)
On Feb 19, 3:26 pm, saLOUt <salout...@googlemail.com> wrote:

> > My idea would be to create a stand alone ruby sumo distrib (rubylab ?)
> > with  Ruby + Tk + Qt + FFI + some science selected extensions.
>
> Didn't read everything. Just want to mention that there will be a Qt-
> Ruby-Gem for Windows release very soon. For Linux there should be pre-
> build packages available for most common distributions.
>
> First adress for ruby + Qt/KDE:http://lists.kde.org/?l=kde-bindings

Great new, thank you for the link.
(I hope the Qt-Ruby-Gem will be multiplatform)

-- Maurice
7ece60b3b5bb235d1b6df89727ca6cf7?d=identicon&s=25 mdiam (Guest)
on 2010-02-20 11:17
(Received via mailing list)
On Feb 19, 6:13 pm, Roger Pack <rogerpack2...@gmail.com> wrote:
> If all you need is swing or the eclipse swt you're good to go (there's
> examples of ruby wrapping the swt in the redcar project).

Not really, jruby (that I like) work on java which
can be see as a platform by itself. So if you need to use
other lib (such as glpk (c), lemon (c++) , coin-or (c++), ..
you have or play with jni interface.

The FFI ffi-tk ruby project should work with any plateform
(e.g.  jruby but also macruby, etc...).
But if Hidetoshi hasn't choose that way (i.e. ffi) for tk,
propably there is a good reason (like the threads, or simply
it much more work ?)

-- Maurice
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-02-20 21:50
> One more thought, on my feeling from what I read in this newsgroup
> about Ruby/Tk on Windows:
> _Until_ a very good solution is available, I think, it would be good
> to have a clear description on how to install Ruby/Tk on Windows,
> using for example ActiveTCL, and having binaries for download.
> Something like Roger Pack provides, but even more.

I've updated
http://wiki.github.com/rdp/ruby_tutorials_core/tk
to be a little more verbose.
Hopefully that will be enough of a stop gap until somebody comes in and
patches RubyInstaller to have the Tk binaries...
-r
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-21 07:21
(Received via mailing list)
From: Axel <a99.googlegroups.a99@dfgh.net>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Sat, 20 Feb 2010 16:15:07 +0900
Message-ID:
<c8479617-faeb-41af-b96d-a0ea083c6fae@f42g2000yqn.googlegroups.com>
> One more thought, on my feeling from what I read in this newsgroup
> about Ruby/Tk on Windows:
> _Until_ a very good solution is available, I think, it would be good
> to have a clear description on how to install Ruby/Tk on Windows,
> using for example ActiveTCL, and having binaries for download.

Of course, if you can, it is the best way to install Tcl/Tk (and Ruby)
on your environment. I never think to change current standard relation
between Ruby and Tcl/Tk libraries.

I think that most of troubles on installation of a binary distribution
depend on:
(1) install wrong version (not supported by tcltklib.so) of Tcl/Tk.
(2) "Path" environment variable doesn't include the folder of Tcl/Tk
    libraries.

Tcl/Tk stubs are usually effective. But sometimes, it generates errors
by uncertain reason.

# On a linux box, I get such errors.
# tcltklib.so with stubs made for Tcl/Tk8.4 doesn't work for Tcl/Tk8.5,
# but works for Tcl/Tk8.6.
# And os the same box, the one made for Tcl/Tk8.5 doesn't work for 8.6.

If can, it is better to distribute 3 version (for Tcl/Tk8.4, 8.5, and
8.6) of tcltklib.so.
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-21 07:24
(Received via mailing list)
From: mdiam <maurice.diamantini@gmail.com>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Sat, 20 Feb 2010 19:16:41 +0900
Message-ID:
<f758cf0f-774f-47a2-8069-1d53ea4b08f7@f15g2000yqe.googlegroups.com>
> The FFI ffi-tk ruby project should work with any plateform
> (e.g.  jruby but also macruby, etc...).
> But if Hidetoshi hasn't choose that way (i.e. ffi) for tk,
> propably there is a good reason (like the threads, or simply
> it much more work ?)

Because I'm not familiar with FFI, I don't have good ideas to soleve
complexity of combination of callbacks, threads, and exceptions.

For example ...
The eventloop is running on thread1.
thread2 calls Tk function1 (send to thread1; serialized on event queue).
thread1 get thread2's request from the event queue.
thread1 call callback1 on Ruby.
callback1 (running on thread1) calls Tk function2.
function2 call callback2 on Ruby.
And, an exception is raised in callback2.
Then, how should we treat the exception?
Tcl/Tk functions know nothing about Ruby threads.

Of course, there are some methods to solve it.
However, those methods may have other problems;
slow operation or response (with lock process),
depend on global variables, explosion of entry tables,
CPU power eater (by busy loop), and so on.
To solve or avoid all of them on Ruby only may be difficult.

# I agree that ffi-tk is valuable even if it has some restrictions.
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-21 08:35
(Received via mailing list)
> Hopefully that will be enough of a stop gap until somebody comes in and
> patches RubyInstaller to have the Tk binaries...
> -r

I think, that's good.
The only thing which might be missing is a gem/binary for Ruby1.8.x +
Tk8.5.
People might want to have it because of better looking (really?)
widgets.
I'll send you an email on this issue.

Axel
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-21 08:46
(Received via mailing list)
> I think that most of troubles on installation of a binary distribution
> depend on:
> (1) install wrong version (not supported by tcltklib.so) of Tcl/Tk.
> (2) "Path" environment variable doesn't include the folder of Tcl/Tk
>     libraries.

I agree. I would add:
(3) Get the binaries in order to avoid compilation; becoming solved
now by Roger Pack.
(4) _Find_ the explanation on how to install ( 1. right versions
are ..., 2. TCL of version xyz from here..., 3. Ruby/Tk-binaries/gems
from rp...,  4. If it does not work, check PATH, path must be...)

Axel
11b74267d849cc2c95e66c634c1b53f9?d=identicon&s=25 Mark Roseman (Guest)
on 2010-02-21 17:50
(Received via mailing list)
Axel <a99.googlegroups.a99@dfgh.net> wrote:
> _Until_ a very good solution is available, I think, it would be good
> to have a clear description on how to install Ruby/Tk on Windows,
> using for example ActiveTCL, and having binaries for download.
> Something like Roger Pack provides, but even more.


Agreed.  I've tried to provide the step-by-steps in my Tk tutorial at
http://www.tkdocs.com (please let me know if there are any
inaccuracies), but I too would like to see this a lot smoother.

The Tclkit-style approach made a huge difference in the Tcl world as far
as ease of deployment, so I'm glad to see it being advanced here as
well.

Mark
86e33dee4a89a8879a26487051c216a8?d=identicon&s=25 Michael Fellinger (Guest)
on 2010-02-21 18:52
(Received via mailing list)
On Sun, Feb 21, 2010 at 3:21 PM, Hidetoshi NAGAI
<nagai@ai.kyutech.ac.jp> wrote:
>
> And, an exception is raised in callback2.
> # I agree that ffi-tk is valuable even if it has some restrictions.
I've solved this by creating a separate thread that handles all calls
using the interp.
http://github.com/manveru/ffi-tk/blob/master/lib/f...
http://github.com/manveru/ffi-tk/blob/master/lib/f...

By using Queue#pop, the code will simply block the Thread until it can
handle a send,
so it's very little overhead, and has zero CPU usage when idle.

On OSX, sometimes only the master thread is allowed to be a sender, so
I handle that case as well.
http://github.com/manveru/ffi-tk/blob/master/lib/f...
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-02-21 23:18
(Received via mailing list)
From: Michael Fellinger <m.fellinger@gmail.com>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Mon, 22 Feb 2010 02:50:45 +0900
Message-ID:
<9c00d3e01002210950t1eab4396xd0fd977201b02d44@mail.gmail.com>
> I've solved this by creating a separate thread that handles all calls
> using the interp.
> http://github.com/manveru/ffi-tk/blob/master/lib/f...
> http://github.com/manveru/ffi-tk/blob/master/lib/f...
>
> By using Queue#pop, the code will simply block the Thread until it can
> handle a send,
> so it's very little overhead, and has zero CPU usage when idle.

After calling Tk.mainloop, is the thread for Tk blocked from other
thread's call?
Although it is important whether threads are switched at proper
timing, thread switching troubles may not occur if ffi-tk supports
ruby1.9 only (I don't know about JRuby's thread switching),

Maybe you should pay attention to exceptions.
Does "reaper" thread down when block.call raises an exception?
When ruby1->tcl-(callback)->ruby2 and ruby2 raises an exception,
can ruby1 get the exception?

I don't read all part of ffi-tk. I'm sorry if I misunderstand.
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-02-22 16:56
> I agree. I would add:
> (3) Get the binaries in order to avoid compilation; becoming solved
> now by Roger Pack.
> (4) _Find_ the explanation on how to install ( 1. right versions
> are ..., 2. TCL of version xyz from here..., 3. Ruby/Tk-binaries/gems
> from rp...,  4. If it does not work, check PATH, path must be...)

Feel free to hack on that wiki page if desired :)
I don't mind :)
-r
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-23 08:24
(Received via mailing list)
> Feel free to hack on that wiki page if desired :)
> I don't mind :)

Thank you, I'll do so - wait :)

Axel
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 Axel (Guest)
on 2010-02-28 14:30
(Received via mailing list)
Roger, could you send me your email address? Can't find it.

Mine:

axel  DOD  friedrich_smail   ED  gmx  DOD  de
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (Guest)
on 2010-03-01 00:55
(Received via mailing list)
On Sun, Feb 21, 2010 at 12:21 AM, Hidetoshi NAGAI
<nagai@ai.kyutech.ac.jp> wrote:
> Because I'm not familiar with FFI, I don't have good ideas to soleve
> complexity of combination of callbacks, threads, and exceptions.
[...]

Manveru has an ffi-tk gem for Ruby 1.9. He says it should run on any
Ruby 1.9 installation that has FFI installed (either as a gem, as with
MRI, or as part of the installation, as with JRuby or Rubinius).

http://github.com/manveru/ffi-tk

Axel wrote:
> axel  DOD  friedrich_smail   ED  gmx  DOD  de

I think you meant "DOT" and "AT".
86e33dee4a89a8879a26487051c216a8?d=identicon&s=25 Michael Fellinger (Guest)
on 2010-03-01 17:33
(Received via mailing list)
On Mon, Mar 1, 2010 at 8:52 AM, Eric Christopherson
<echristopherson@gmail.com> wrote:
>>> it much more work ?)
>>
>> Because I'm not familiar with FFI, I don't have good ideas to soleve
>> complexity of combination of callbacks, threads, and exceptions.
> [...]
>
> Manveru has an ffi-tk gem for Ruby 1.9. He says it should run on any
> Ruby 1.9 installation that has FFI installed (either as a gem, as with
> MRI, or as part of the installation, as with JRuby or Rubinius).

I actually just tested it on windows today, had to do some tweaks, but
it runs (together with EM even) with just two lines of modification (i
had guessed the name of the dll wrong).
Will push a new gem tomorrow when i get confirmation that OSX still
works.
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2010-03-14 07:49
(Received via mailing list)
From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Thu, 18 Feb 2010 08:46:15 +0900
Message-ID: <20100218.084610.78704908.nagai@ai.kyutech.ac.jp>
> I know that there are many problems to install or distribute Ruby/Tk.
> I have a plan to create tcltklib.so includeing a Tcl/Tk environment.

Now, you can download test versions of such tcltklib.so
for Linux box from
<http://www.dumbo.ai.kyutech.ac.jp/~nagai/RubyTk/?R....
(Sorry. It is a Japanese page.There are download links at mid of the
page.)
Each of them includes Tcl/Tk8.4.18, Japanese encodings and tkImg
extension.

One is for ruby 1.9.2dev (trunk), and another is for 1.8.8dev
(ruby_1_8).
Please rename the downloaded file to tcltklib.so, and replace it
to the original one.

Any comments are welcome.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.