Class: AnimatedTextLabel

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

Overview

animated label

Direct Known Subclasses

AnimatedImageLabel

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AnimatedTextLabel

Returns a new instance of AnimatedTextLabel.



58
59
60
61
62
63
64
65
# File 'sample/demos-jp/anilabel.rb', line 58

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



73
74
75
76
# File 'sample/demos-jp/anilabel.rb', line 73

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

#stopObject



78
79
80
# File 'sample/demos-jp/anilabel.rb', line 78

def stop
  @timer.stop
end