Class: AnimatedTextLabel

Inherits:
TkLabel
  • Object
show all
Defined in:
sample/demos-en/anilabel.rb,
sample/demos-jp/anilabel.rb

Overview

animated label

Direct Known Subclasses

AnimatedImageLabel

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AnimatedTextLabel

Returns a new instance of AnimatedTextLabel.



56
57
58
59
60
61
62
63
# File 'sample/demos-en/anilabel.rb', line 56

def initialize(*args)
  super(*args)
  @timer = TkTimer.new{ _animation_callback }
  @timer.loop_exec = -1
  # bind('Destroy'){ @timer.stop }
  @btag = TkBindTag.new('Destroy'){ @timer.stop }
  self.bindtags_unshift(@btag)
end

Instance Method Details

#start(interval) ⇒ Object



71
72
73
74
# File 'sample/demos-en/anilabel.rb', line 71

def start(interval)
  @timer.set_interval(interval)
  @timer.start
end

#stopObject



76
77
78
# File 'sample/demos-en/anilabel.rb', line 76

def stop
  @timer.stop
end