Following operators support logical expressions of canvas tags (for Tk8.3+). If tag1.path is 't1' and tag2.path is 't2', then
ltag = tag1 & tag2; ltag.path => "(t1)&&(t2)" ltag = tag1 | tag2; ltag.path => "(t1)||(t2)" ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)" ltag = - tag1; ltag.path => "!(t1)"
# File tk/lib/tk/canvastag.rb, line 169
def & (tag)
if tag.kind_of? TkObject
TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
else
TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')')
end
end
# File tk/lib/tk/canvastag.rb, line 193
def -@
TkcTagString.new(@c, '!(' + @id + ')')
end
# File tk/lib/tk/canvastag.rb, line 185
def ^ (tag)
if tag.kind_of? TkObject
TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
else
TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')')
end
end
# File tk/lib/tk/canvastag.rb, line 15
def addtag(tag)
@c.addtag(tag, 'withtag', @id)
self
end
def bind(seq, cmd=Proc.new, *args)
@c.itembind(@id, seq, cmd, *args) self
end
# File tk/lib/tk/canvastag.rb, line 28
def bind(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
@c.itembind(@id, seq, cmd, *args)
self
end
def #bind_append(seq, cmd=Proc.new, *args)
@c.itembind_append(@id, seq, cmd, *args) self
end
# File tk/lib/tk/canvastag.rb, line 43
def bind_append(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
@c.itembind_append(@id, seq, cmd, *args)
self
end
# File tk/lib/tk/canvastag.rb, line 54
def bind_remove(seq)
@c.itembind_remove(@id, seq)
self
end
# File tk/lib/tk/canvastag.rb, line 59
def bindinfo(seq=nil)
@c.itembindinfo(@id, seq)
end
# File tk/lib/tk/canvastag.rb, line 63
def cget(option)
@c.itemcget(@id, option)
end
def configure(keys)
@c.itemconfigure @id, keys
end
# File tk/lib/tk/canvastag.rb, line 75
def configinfo(key=nil)
@c.itemconfiginfo(@id, key)
end
# File tk/lib/tk/canvastag.rb, line 67
def configure(key, value=None)
@c.itemconfigure(@id, key, value)
self
end
# File tk/lib/tk/canvastag.rb, line 83
def coords(*args)
@c.coords(@id, *args)
end
# File tk/lib/tk/canvastag.rb, line 79
def current_configinfo(key=nil)
@c.current_itemconfiginfo(@id, key)
end
# File tk/lib/tk/canvastag.rb, line 87
def dchars(first, last=None)
@c.dchars(@id, first, last)
self
end
# File tk/lib/tk/canvastag.rb, line 92
def dtag(tag_to_del=None)
@c.dtag(@id, tag_to_del)
self
end
# File tk/lib/tk/canvastag.rb, line 98
def find
@c.find('withtag', @id)
end
# File tk/lib/tk/canvastag.rb, line 103
def focus
@c.itemfocus(@id)
end
# File tk/lib/tk/canvastag.rb, line 111
def icursor(index)
@c.icursor(@id, index)
self
end
# File tk/lib/tk/canvastag.rb, line 116
def index(idx)
@c.index(@id, idx)
end
# File tk/lib/tk/canvastag.rb, line 120
def insert(beforethis, string)
@c.insert(@id, beforethis, string)
self
end
# File tk/lib/tk/canvastag.rb, line 158
def itemtype
@c.itemtype(@id)
end
# File tk/lib/tk/canvastag.rb, line 125
def lower(belowthis=None)
@c.lower(@id, belowthis)
self
end
# File tk/lib/tk/canvastag.rb, line 130
def move(xamount, yamount)
@c.move(@id, xamount, yamount)
self
end
# File tk/lib/tk/canvastag.rb, line 135
def raise(abovethis=None)
@c.raise(@id, abovethis)
self
end
# File tk/lib/tk/canvastag.rb, line 140
def scale(xorigin, yorigin, xscale, yscale)
@c.scale(@id, xorigin, yorigin, xscale, yscale)
self
end
# File tk/lib/tk/canvastag.rb, line 145
def select_adjust(index)
@c.select('adjust', @id, index)
self
end
# File tk/lib/tk/canvastag.rb, line 149
def select_from(index)
@c.select('from', @id, index)
self
end