Using additional widget in Ruby
Is it possible to install an additional widget written in Tcl/Tk and using
that widget in ruby without the change of any libraries? That should be
possible, because when copying that file to some place where Tcl will find
it, it is possible to start it without changing any library files or
compiling anything (Tcl is a scripting language, isn't it)?
The task I want to do is to install Bryan Douglas Oakley combobox and
using it in Ruby.
By the side, has anyone a description how the integration of Tcl/Tk in
ruby is done? I don't get it at the moment, and it looks sometimes as
magic what is going on. If anyone has an explanation what is going on, I
could read that and don't ask silly questions in this newsgroup.
Markus Liebelt; firstname.lastname@example.org
Re: Using additional widget in Ruby
From: "Markus Liebelt" <email@example.com>
Subject: Using additional widget in Ruby
Date: Sat, 8 Jan 2005 01:51:28 +0900
> Is it possible to install an additional widget written in Tcl/Tk and using
> that widget in ruby without the change of any libraries?
Yes, of course.
Please see tktree.rb and tktree.tcl included in the Ruby source archive.
You can find them ext/tk/sample directory. Probably, they exist at the
samples folder of the one-click-ruby-installer.
tktree.tcl is a widget written in pure Tcl/Tk.
tktree.rb is a wrapper of the tktree widget.
> The task I want to do is to install Bryan Douglas Oakley combobox and
> using it in Ruby.
If your Tcl/Tk can load the library, you can use it on your Ruby/Tk.
However, you may have to add the library path to Tk::AUTO_PATH or
Tk::PACKAGE_PATH or Tk::LIBRARY_PATH.
To create and control the widget class, please use Tk.tk_call.
Ruby/Tk can call all functions of Tcl/Tk, and can load Tcl/Tk scripts.
Even if Tcl/Tk's functions aren't wrapped by Ruby's classes or methods,
they can be called by Tk.tk_call (or TkCore::INTERP._invoke).
Tk.tk_call does NOT use Tcl/Tk's command line parser for the reason of
It uses Tcl_GetCommandInfo() function to search Tcl/Tk's commands.
Therefore, in rare cases, Ruby/Tk fails to autoload Tcl/Tk libraries.
When you have such troubles, please use Tk.ip_eval method to call the
Tcl/Tk command. The methods passes the argument string to Tcl/Tk's
command line parser.
Hidetoshi NAGAI (firstname.lastname@example.org)
|All times are GMT. The time now is 10:36 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.