Ruby/tk and bwidget?


Can I use somehow this lib with ruby? I do not know much about tk’s
internals, especially with langs other than tcl, but I see that it is
possible to start a tcl interpreter from ruby/tk.

I didn’t find much doc about ruby/tk, and much less about ruby/tcltk (I
have found a few rows in the FAQ)… So, can I run arbitrary tcl code in
a ruby program, pass variable both ways, and use ruby/tk with executing
tcl code (e.g. BWidget source)?


PS: The actual problem what I wanted to solve is to find a tree

there’s Tix, a Tk extension. its linux only, i think, but it has a tree
widget and it works. if you want to install i described the process (as
all the instructions are in japanese) in an earlier post: ruby-talk


On Tue, 2002-07-23 at 19:47, Ferenc Engard wrote:

PS: The actual problem what I wanted to solve is to find a tree


I reply to myself:

I have found two essential info in tcltk.rb, which helped to use
BWidget: there is a TclTkInterpreter class, and it has an ‘eval’ method.

So, this code works:

require “tcltk”

$tclInterp.eval <<END
package require BWidget
ScrolledWindow .scr
set t [Tree .scr.tree -padx 0]
.scr setwidget $t
pack .scr -expand 1 -fill both

… and so on.

That’s cool, but it would be great if I could get more info about the
tcltk module. With this information, now I can write tcl/tk programs in
ruby, that’s cool, but it doesn’t have much sense. :slight_smile: If I could bind
ruby and tcl variables, for example… Or doing other things in ruby
like with ‘tk’ module…