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.



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

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



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

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

#stopObject



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

def stop
  @timer.stop
end