Skip to content

Instantly share code, notes, and snippets.

@komiyake
Created December 11, 2014 07:47
Show Gist options
  • Save komiyake/4d8561b1e9f6971939bb to your computer and use it in GitHub Desktop.
Save komiyake/4d8561b1e9f6971939bb to your computer and use it in GitHub Desktop.
RubyのTkを用いてニコニコ動画みたいに文字を左から右に流す
#!/usr/bin/ruby
require 'tk'
c = Tk::Canvas.new(nil, :width=>600, :height=>400, :relief=>:sunken,
:borderwidth=>3).pack(:fill=>:both, :expand=>true)
f = TkFont.new('Helvetica -16')
tag = TkcTag.new(c)
t = Thread.new do
for i in 0..600/4
t = TkcText.new(c, 600-i*4, 200, :text=>'test object', :font=>f, :tags=>tag)
sleep 0.1
t.delete
end
end
Tk.mainloop
t.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment