Class: TclTkVariable (Ruby 2.3.4)

In Files

  • tk/lib/tcltk.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

TclTkVariable

class TclTkVariable: tcl/tk variable

Public Class Methods

new(interp, dat)

initialize(interp, dat):

interp: interpreter(TclTkInterpreter)
dat: the value to set(String)
    if nil, not initialize variable
 
               # File tk/lib/tcltk.rb, line 230
def initialize(interp, dat)
  # auto-generate tcl/tk representation (variable name)
  exp = TclTk._newname("v_")
  # initialize TclTkObject
  super(interp._tcltkip(), exp)
  # safe this for `set' command
  @set = interp.commands()["set"]
  # set value
  set(dat) if dat
end
            

Public Instance Methods

get()

get(): read tcl/tk variable(String) using `set’

 
               # File tk/lib/tcltk.rb, line 251
def get()
  return @set.e(to_s())
end
            
set(data)

set(data): set tcl/tk variable using `set’

data: new value
 
               # File tk/lib/tcltk.rb, line 246
def set(data)
  @set.e(to_s(), data.to_s())
end