Hidetoshi NAGAI
2/5/2009 8:08:00 PM
From: Ukrit Himakoon <tuky42@hotmail.com>
Subject: Tcl execution by ruby?
Date: Thu, 5 Feb 2009 17:21:11 +0900
Message-ID: <26291dc471038f215e0f7743721530f2@ruby-forum.com>
> is there anyway to run Tcl from Ruby??
----------------------------------------------------------------------------
require 'tk'
Tk.load_tclscript(tcl_script_file, encoding=nil) # => use 'source' command
Tk.load_tcllibrary(file, pkg_name=None, interp=None) #=> use 'load' command
Tk.ip_eval(tcl_script_string) # eval the string as a bit of a tcl script
Tk.tk_call(arg, ....) # each arg is a token of command line
TkComm.window(widget_path) # get a widget object if the widget exists
----------------------------------------------------------------------------
If you want to call a Tcl script without Tk,
----------------------------------------------------------------------------
require 'tcltklib'
interp = TclTkIp.new(ip_name, false)
interp._invoke('info', 'patchlevel')
interp._eval('puts foo; info patchlevel')
----------------------------------------------------------------------------
# see '<ruby-src-tree>/ext/tk/MANUAL_tcltklib.eng'
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)