1998-01-16 07:19:09 -05:00
|
|
|
# tof
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#### tcltk library, more direct manipulation of tcl/tk
|
2004-10-11 00:51:21 -04:00
|
|
|
#### Sep. 5, 1997 Y. Shigehiro
|
1998-01-16 07:19:09 -05:00
|
|
|
|
|
|
|
require "tcltklib"
|
|
|
|
|
|
|
|
################
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# module TclTk: collection of tcl/tk utilities (supplies namespace.)
|
1998-01-16 07:19:09 -05:00
|
|
|
module TclTk
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize Hash to hold unique symbols and such
|
1998-01-16 07:19:09 -05:00
|
|
|
@namecnt = {}
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize Hash to hold callbacks
|
1998-01-16 07:19:09 -05:00
|
|
|
@callback = {}
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk.mainloop(): call TclTkLib.mainloop()
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk.mainloop()
|
|
|
|
print("mainloop: start\n") if $DEBUG
|
|
|
|
TclTkLib.mainloop()
|
|
|
|
print("mainloop: end\n") if $DEBUG
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk.deletecallbackkey(ca): remove callback from TclTk module
|
|
|
|
# this does not remove callbacks from tcl/tk interpreter
|
|
|
|
# without calling this method, TclTkInterpreter will not be GCed
|
|
|
|
# ca: callback(TclTkCallback)
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk.deletecallbackkey(ca)
|
|
|
|
print("deletecallbackkey: ", ca.to_s(), "\n") if $DEBUG
|
|
|
|
@callback.delete(ca.to_s)
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk.dcb(ca, wid, W): call TclTk.deletecallbackkey() for each callbacks
|
|
|
|
# in an array.
|
|
|
|
# this is for callback for top-level <Destroy>
|
|
|
|
# ca: array of callbacks(TclTkCallback)
|
|
|
|
# wid: top-level widget(TclTkWidget)
|
|
|
|
# w: information about window given by %W(String)
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk.dcb(ca, wid, w)
|
|
|
|
if wid.to_s() == w
|
|
|
|
ca.each{|i|
|
|
|
|
TclTk.deletecallbackkey(i)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk._addcallback(ca): register callback
|
|
|
|
# ca: callback(TclTkCallback)
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk._addcallback(ca)
|
|
|
|
print("_addcallback: ", ca.to_s(), "\n") if $DEBUG
|
|
|
|
@callback[ca.to_s()] = ca
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk._callcallback(key, arg): invoke registered callback
|
|
|
|
# key: key to select callback (to_s value of the TclTkCallback)
|
|
|
|
# arg: parameter from tcl/tk interpreter
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk._callcallback(key, arg)
|
|
|
|
print("_callcallback: ", @callback[key].inspect, "\n") if $DEBUG
|
|
|
|
@callback[key]._call(arg)
|
1999-01-19 23:59:39 -05:00
|
|
|
# throw out callback value
|
|
|
|
# should return String to satisfy rb_eval_string()
|
1998-01-16 07:19:09 -05:00
|
|
|
return ""
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# TclTk._newname(prefix): generate unique name(String)
|
|
|
|
# prefix: prefix of the unique name
|
1998-01-16 07:19:09 -05:00
|
|
|
def TclTk._newname(prefix)
|
1999-01-19 23:59:39 -05:00
|
|
|
# generated name counter is stored in @namecnt
|
1998-01-16 07:19:09 -05:00
|
|
|
if !@namecnt.key?(prefix)
|
1999-01-19 23:59:39 -05:00
|
|
|
# first appearing prefix, initialize
|
1998-01-16 07:19:09 -05:00
|
|
|
@namecnt[prefix] = 1
|
|
|
|
else
|
1999-01-19 23:59:39 -05:00
|
|
|
# already appeared prefix, generate next name
|
1998-01-16 07:19:09 -05:00
|
|
|
@namecnt[prefix] += 1
|
|
|
|
end
|
|
|
|
return "#{prefix}#{@namecnt[prefix]}"
|
|
|
|
end
|
|
|
|
|
|
|
|
################
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkInterpreter: tcl/tk interpreter
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkInterpreter
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize():
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize()
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate interpreter object
|
1998-01-16 07:19:09 -05:00
|
|
|
@ip = TclTkIp.new()
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# add ruby_fmt command to tcl interpreter
|
|
|
|
# ruby_fmt command format arguments by `format' and call `ruby' command
|
|
|
|
# (notice ruby command receives only one argument)
|
1998-01-16 07:19:09 -05:00
|
|
|
if $DEBUG
|
2003-08-02 22:34:02 -04:00
|
|
|
@ip._eval("proc ruby_fmt {fmt args} { puts \"ruby_fmt: $fmt $args\" ; set cmd [list ruby [format $fmt $args]] ; uplevel $cmd }")
|
1998-01-16 07:19:09 -05:00
|
|
|
else
|
2003-08-02 22:34:02 -04:00
|
|
|
@ip._eval("proc ruby_fmt {fmt args} { set cmd [list ruby [format $fmt $args]] ; uplevel $cmd }")
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# @ip._get_eval_string(*args): generate string to evaluate in tcl interpreter
|
|
|
|
# *args: script which is going to be evaluated under tcl/tk
|
1998-01-16 07:19:09 -05:00
|
|
|
def @ip._get_eval_string(*args)
|
|
|
|
argstr = ""
|
|
|
|
args.each{|arg|
|
2004-10-11 00:51:21 -04:00
|
|
|
argstr += " " if argstr != ""
|
|
|
|
# call to_eval if it is defined
|
|
|
|
if (arg.respond_to?(:to_eval))
|
|
|
|
argstr += arg.to_eval()
|
|
|
|
else
|
|
|
|
# call to_s unless defined
|
|
|
|
argstr += arg.to_s()
|
|
|
|
end
|
1998-01-16 07:19:09 -05:00
|
|
|
}
|
|
|
|
return argstr
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# @ip._eval_args(*args): evaluate string under tcl/tk interpreter
|
|
|
|
# returns result string.
|
|
|
|
# *args: script which is going to be evaluated under tcl/tk
|
1998-01-16 07:19:09 -05:00
|
|
|
def @ip._eval_args(*args)
|
1999-01-19 23:59:39 -05:00
|
|
|
# calculate the string to eval in the interpreter
|
1998-01-16 07:19:09 -05:00
|
|
|
argstr = _get_eval_string(*args)
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# evaluate under the interpreter
|
1998-01-16 07:19:09 -05:00
|
|
|
print("_eval: \"", argstr, "\"") if $DEBUG
|
|
|
|
res = _eval(argstr)
|
|
|
|
if $DEBUG
|
2004-10-11 00:51:21 -04:00
|
|
|
print(" -> \"", res, "\"\n")
|
1998-01-16 07:19:09 -05:00
|
|
|
elsif _return_value() != 0
|
2004-10-11 00:51:21 -04:00
|
|
|
print(res, "\n")
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
1999-01-19 23:59:39 -05:00
|
|
|
fail(%Q/can't eval "#{argstr}"/) if _return_value() != 0 #'
|
1998-01-16 07:19:09 -05:00
|
|
|
return res
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate tcl/tk command object and register in the hash
|
1998-01-16 07:19:09 -05:00
|
|
|
@commands = {}
|
1999-01-19 23:59:39 -05:00
|
|
|
# for all commands registered in tcl/tk interpreter:
|
1998-01-16 07:19:09 -05:00
|
|
|
@ip._eval("info command").split(/ /).each{|comname|
|
|
|
|
if comname =~ /^[.]/
|
2004-10-11 00:51:21 -04:00
|
|
|
# if command is a widget (path), generate TclTkWidget,
|
|
|
|
# and register it in the hash
|
|
|
|
@commands[comname] = TclTkWidget.new(@ip, comname)
|
1998-01-16 07:19:09 -05:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
# otherwise, generate TclTkCommand
|
|
|
|
@commands[comname] = TclTkCommand.new(@ip, comname)
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# commands(): returns hash of the tcl/tk commands
|
1998-01-16 07:19:09 -05:00
|
|
|
def commands()
|
|
|
|
return @commands
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# rootwidget(): returns root widget(TclTkWidget)
|
1998-01-16 07:19:09 -05:00
|
|
|
def rootwidget()
|
|
|
|
return @commands["."]
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# _tcltkip(): returns @ip(TclTkIp)
|
1998-01-16 07:19:09 -05:00
|
|
|
def _tcltkip()
|
|
|
|
return @ip
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# method_missing(id, *args): execute undefined method as tcl/tk command
|
|
|
|
# id: method symbol
|
|
|
|
# *args: method arguments
|
1998-01-16 07:19:09 -05:00
|
|
|
def method_missing(id, *args)
|
1999-01-19 23:59:39 -05:00
|
|
|
# if command named by id registered, then execute it
|
1998-01-16 07:19:09 -05:00
|
|
|
if @commands.key?(id.id2name)
|
|
|
|
return @commands[id.id2name].e(*args)
|
|
|
|
else
|
1999-01-19 23:59:39 -05:00
|
|
|
# otherwise, exception
|
1998-01-16 07:19:09 -05:00
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkObject: base class of the tcl/tk objects
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkObject
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(ip, exp):
|
1999-01-19 23:59:39 -05:00
|
|
|
# ip: interpreter(TclTkIp)
|
|
|
|
# exp: tcl/tk representation
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(ip, exp)
|
|
|
|
fail("type is not TclTkIp") if !ip.kind_of?(TclTkIp)
|
|
|
|
@ip = ip
|
|
|
|
@exp = exp
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# to_s(): returns tcl/tk representation
|
1998-01-16 07:19:09 -05:00
|
|
|
def to_s()
|
|
|
|
return @exp
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkCommand: tcl/tk commands
|
|
|
|
# you should not call TclTkCommand.new()
|
|
|
|
# commands are created by TclTkInterpreter:initialize()
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkCommand < TclTkObject
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# e(*args): execute command. returns String (e is for exec or eval)
|
|
|
|
# *args: command arguments
|
1998-01-16 07:19:09 -05:00
|
|
|
def e(*args)
|
|
|
|
return @ip._eval_args(to_s(), *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkLibCommand: tcl/tk commands in the library
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkLibCommand < TclTkCommand
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(ip, name):
|
1999-01-19 23:59:39 -05:00
|
|
|
# ip: interpreter(TclTkInterpreter)
|
|
|
|
# name: command name (String)
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(ip, name)
|
|
|
|
super(ip._tcltkip, name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkVariable: tcl/tk variable
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkVariable < TclTkObject
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(interp, dat):
|
1999-01-19 23:59:39 -05:00
|
|
|
# interp: interpreter(TclTkInterpreter)
|
|
|
|
# dat: the value to set(String)
|
|
|
|
# if nil, not initialize variable
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(interp, dat)
|
1999-01-19 23:59:39 -05:00
|
|
|
# auto-generate tcl/tk representation (variable name)
|
1998-01-16 07:19:09 -05:00
|
|
|
exp = TclTk._newname("v_")
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize TclTkObject
|
1998-01-16 07:19:09 -05:00
|
|
|
super(interp._tcltkip(), exp)
|
1999-01-19 23:59:39 -05:00
|
|
|
# safe this for `set' command
|
1998-01-16 07:19:09 -05:00
|
|
|
@set = interp.commands()["set"]
|
1999-01-19 23:59:39 -05:00
|
|
|
# set value
|
1998-01-16 07:19:09 -05:00
|
|
|
set(dat) if dat
|
|
|
|
end
|
|
|
|
|
2009-02-10 03:55:40 -05:00
|
|
|
# although you can set/read variables by using set in tcl/tk,
|
1999-01-19 23:59:39 -05:00
|
|
|
# we provide the method for accessing variables
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# set(data): set tcl/tk variable using `set'
|
|
|
|
# data: new value
|
1998-01-16 07:19:09 -05:00
|
|
|
def set(data)
|
|
|
|
@set.e(to_s(), data.to_s())
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# get(): read tcl/tk variable(String) using `set'
|
1998-01-16 07:19:09 -05:00
|
|
|
def get()
|
|
|
|
return @set.e(to_s())
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkWidget: tcl/tk widget
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkWidget < TclTkCommand
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(*args):
|
1999-01-19 23:59:39 -05:00
|
|
|
# *args: parameters
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(*args)
|
|
|
|
if args[0].kind_of?(TclTkIp)
|
1999-01-19 23:59:39 -05:00
|
|
|
# in case the 1st argument is TclTkIp:
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# Wrap tcl/tk widget by TclTkWidget
|
|
|
|
# (used in TclTkInterpreter#initialize())
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# need two arguments
|
* regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
ext/openssl/ossl_bn.c, numeric.c, vm.c,
benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
for non law violation context.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 21:31:11 -05:00
|
|
|
fail("invalid # of parameter") if args.size != 2
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# ip: interpreter(TclTkIp)
|
|
|
|
# exp: tcl/tk representation
|
1998-01-16 07:19:09 -05:00
|
|
|
ip, exp = args
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize TclTkObject
|
1998-01-16 07:19:09 -05:00
|
|
|
super(ip, exp)
|
|
|
|
elsif args[0].kind_of?(TclTkInterpreter)
|
1999-01-19 23:59:39 -05:00
|
|
|
# in case 1st parameter is TclTkInterpreter:
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate new widget from parent widget
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# interp: interpreter(TclTkInterpreter)
|
|
|
|
# parent: parent widget
|
2011-09-14 13:25:37 -04:00
|
|
|
# command: widget generating tk command(label 等)
|
2009-03-05 22:56:38 -05:00
|
|
|
# *args: argument to the command
|
1998-01-16 07:19:09 -05:00
|
|
|
interp, parent, command, *args = args
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate widget name
|
1998-01-16 07:19:09 -05:00
|
|
|
exp = parent.to_s()
|
|
|
|
exp += "." if exp !~ /[.]$/
|
|
|
|
exp += TclTk._newname("w_")
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize TclTkObject
|
1998-01-16 07:19:09 -05:00
|
|
|
super(interp._tcltkip(), exp)
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate widget
|
1998-01-16 07:19:09 -05:00
|
|
|
res = @ip._eval_args(command, exp, *args)
|
|
|
|
# fail("can't create Widget") if res != exp
|
1999-01-19 23:59:39 -05:00
|
|
|
# for tk_optionMenu, it is legal res != exp
|
1998-01-16 07:19:09 -05:00
|
|
|
else
|
|
|
|
fail("first parameter is not TclTkInterpreter")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkCallback: tcl/tk callbacks
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkCallback < TclTkObject
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(interp, pr, arg):
|
1999-01-19 23:59:39 -05:00
|
|
|
# interp: interpreter(TclTkInterpreter)
|
|
|
|
# pr: callback procedure(Proc)
|
|
|
|
# arg: string to pass as block parameters of pr
|
|
|
|
# bind command of tcl/tk uses % replacement for parameters
|
|
|
|
# pr can receive replaced data using block parameter
|
|
|
|
# its format is specified by arg string
|
2009-03-05 22:56:38 -05:00
|
|
|
# You should not specify arg for the command like
|
1999-01-19 23:59:39 -05:00
|
|
|
# scrollbar with -command option, which receives parameters
|
|
|
|
# without specifying any replacement
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(interp, pr, arg = nil)
|
1999-01-19 23:59:39 -05:00
|
|
|
# auto-generate tcl/tk representation (variable name)
|
1998-01-16 07:19:09 -05:00
|
|
|
exp = TclTk._newname("c_")
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize TclTkObject
|
1998-01-16 07:19:09 -05:00
|
|
|
super(interp._tcltkip(), exp)
|
1999-01-19 23:59:39 -05:00
|
|
|
# save parameters
|
1998-01-16 07:19:09 -05:00
|
|
|
@pr = pr
|
|
|
|
@arg = arg
|
1999-01-19 23:59:39 -05:00
|
|
|
# register in the module
|
1998-01-16 07:19:09 -05:00
|
|
|
TclTk._addcallback(self)
|
|
|
|
end
|
|
|
|
|
2013-12-28 03:25:28 -05:00
|
|
|
# to_eval(): returns string representation for @ip._eval_args
|
1998-01-16 07:19:09 -05:00
|
|
|
def to_eval()
|
|
|
|
if @arg
|
1999-01-19 23:59:39 -05:00
|
|
|
# bind replaces %s before calling ruby_fmt, so %%s is used
|
1998-01-16 07:19:09 -05:00
|
|
|
s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%%s")} #{@arg}}/
|
|
|
|
else
|
|
|
|
s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%s")}}/
|
|
|
|
end
|
|
|
|
|
|
|
|
return s
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# _call(arg): invoke callback
|
|
|
|
# arg: callback parameter
|
1998-01-16 07:19:09 -05:00
|
|
|
def _call(arg)
|
|
|
|
@pr.call(arg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
# class TclTkImage: tcl/tk images
|
1998-01-16 07:19:09 -05:00
|
|
|
class TclTkImage < TclTkCommand
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# initialize(interp, t, *args):
|
1999-01-19 23:59:39 -05:00
|
|
|
# generating image is done by TclTkImage.new()
|
2013-12-28 03:25:28 -05:00
|
|
|
# destroying is done by image delete (inconsistent, sigh)
|
1999-01-19 23:59:39 -05:00
|
|
|
# interp: interpreter(TclTkInterpreter)
|
|
|
|
# t: image type (photo, bitmap, etc.)
|
|
|
|
# *args: command argument
|
1998-01-16 07:19:09 -05:00
|
|
|
def initialize(interp, t, *args)
|
1999-01-19 23:59:39 -05:00
|
|
|
# auto-generate tcl/tk representation
|
1998-01-16 07:19:09 -05:00
|
|
|
exp = TclTk._newname("i_")
|
1999-01-19 23:59:39 -05:00
|
|
|
# initialize TclTkObject
|
1998-01-16 07:19:09 -05:00
|
|
|
super(interp._tcltkip(), exp)
|
1999-01-19 23:59:39 -05:00
|
|
|
# generate image
|
1998-01-16 07:19:09 -05:00
|
|
|
res = @ip._eval_args("image create", t, exp, *args)
|
|
|
|
fail("can't create Image") if res != exp
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# eof
|