Tk on Windows and Mac OS X 10.6

On Feb 19, 3:26 pm, saLOUt [email protected] 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:The Kde-bindings Archives

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

– Maurice

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 P. provides, but even more.

Axel

On Feb 19, 6:13 pm, Roger P. [email protected] 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

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 P. 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

From: Axel [email protected]
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Sat, 20 Feb 2010 16:15:07 +0900
Message-ID:
[email protected]

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.

From: mdiam [email protected]
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Sat, 20 Feb 2010 19:16:41 +0900
Message-ID:
[email protected]

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.

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

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 P…
(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

Axel [email protected] 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 P. 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

From: Michael F. [email protected]
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Mon, 22 Feb 2010 02:50:45 +0900
Message-ID:
[email protected]

I’ve solved this by creating a separate thread that handles all calls
using the interp.
ffi-tk/lib/ffi-tk/ffi/tcl.rb at master · manveru/ffi-tk · GitHub
ffi-tk/lib/ffi-tk/thread_sender.rb at master · manveru/ffi-tk · GitHub

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.

I agree. I would add:
(3) Get the binaries in order to avoid compilation; becoming solved
now by Roger P…
(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 :slight_smile:
I don’t mind :slight_smile:
-r

Feel free to hack on that wiki page if desired :slight_smile:
I don’t mind :slight_smile:

Thank you, I’ll do so - wait :slight_smile:

Axel

On Sun, Feb 21, 2010 at 3:21 PM, Hidetoshi NAGAI
[email protected] 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.

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.

Roger, could you send me your email address? Can’t find it.

Mine:

axel DOD friedrich_smail ED gmx DOD de

On Mon, Mar 1, 2010 at 8:52 AM, Eric C.
[email protected] 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.

On Sun, Feb 21, 2010 at 12:21 AM, Hidetoshi NAGAI
[email protected] 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).

Axel wrote:

axel DOD friedrich_smail ED gmx DOD de

I think you meant “DOT” and “AT”.

From: Hidetoshi NAGAI [email protected]
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Thu, 18 Feb 2010 08:46:15 +0900
Message-ID: [email protected]

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/?Ruby%2FTk-Kit.
(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.