Created
December 11, 2014 07:47
-
-
Save komiyake/4d8561b1e9f6971939bb to your computer and use it in GitHub Desktop.
RubyのTkを用いてニコニコ動画みたいに文字を左から右に流す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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