Tk on Windows and Mac OS X 10.6

  • Thread starter Eric Christopherson
  • Start date
A

Axel

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

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
 
M

mdiam

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
 
M

mdiam

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

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
 
R

Roger Pack

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
 
H

Hidetoshi NAGAI

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: said:
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.
 
H

Hidetoshi NAGAI

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: said:
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.
 
A

Axel

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
 
A

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 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
 
M

Mark Roseman

Axel said:
_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
 
M

Michael Fellinger

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]= s.com>

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.

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/ffi-tk/ffi/tcl.rb#L57
http://github.com/manveru/ffi-tk/blob/master/lib/ffi-tk/thread_sender.rb

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/ffi-tk/ffi/tcl.rb#L76
 
H

Hidetoshi NAGAI

From: Michael Fellinger <[email protected]>
Subject: Re: Tk on Windows and Mac OS X 10.6
Date: Mon, 22 Feb 2010 02:50:45 +0900
Message-ID: said:
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/ffi-tk/ffi/tcl.rb#L57
http://github.com/manveru/ffi-tk/blob/master/lib/ffi-tk/thread_sender.rb

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

Roger Pack

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
 
A

Axel

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

Mine:

axel DOD friedrich_smail ED gmx DOD de
 
E

Eric Christopherson

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]= s.com>

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 DOD friedrich_smail ED gmx DOD de

I think you meant "DOT" and "AT".
 
M

Michael Fellinger

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]= ps.com>

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.
http://github.com/manveru/ffi-tk
=A0de

I think you meant "DOT" and "AT".


--=20
Michael Fellinger
CTO, The Rubyists, LLC
 
H

Hidetoshi NAGAI

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: said:
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/Tk-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.
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top