diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 20:57:30 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 20:57:30 +0000 |
commit | 54ec1c4fe81672ca66f327ef6ae170f458cd79e5 (patch) | |
tree | 45a752c60a9a08d681a792b70f43c89903b638a2 /ruby_1_8_5/ext/tk/sample/binstr_usage.rb | |
parent | d464704f111d211c1f1ff9ef23ef1d755054be00 (diff) |
sorry. I made wrong tags.v1_8_5_54
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_54@13009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_1_8_5/ext/tk/sample/binstr_usage.rb')
-rw-r--r-- | ruby_1_8_5/ext/tk/sample/binstr_usage.rb | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/ruby_1_8_5/ext/tk/sample/binstr_usage.rb b/ruby_1_8_5/ext/tk/sample/binstr_usage.rb deleted file mode 100644 index 91692856f9..0000000000 --- a/ruby_1_8_5/ext/tk/sample/binstr_usage.rb +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env ruby - -require "tk" - -TkMessage.new(:width=>360, :text=><<EOM).pack -This sample shows how to use a binary sequence between Ruby and Tk. \ -This reads the image data from the file as the binary sequence. - -To treat the difference of encodings between on Ruby and on Tk seamlessly, \ -Ruby/Tk converts the encoding of string arguments automatically. \ -I think it is comfortable for users on almost all situations. \ -However, when treats a binary sequence, the convert process makes troubles. - -Tk::BinaryString class (subclass of Tk::EncodedString class) is the class \ -to avoid such troubles. Please see the source code of this sample. \ -A Tk::BinaryString instance is used to create the image for the center button. -EOM - -ImgFile=['images','tcllogo.gif'].join(File::Separator) - -ph1 = TkPhotoImage.new(:file=>ImgFile) -p ph1.configinfo - -b_str = Tk::BinaryString(IO.read(ImgFile)) -p [b_str, b_str.encoding] - -ph2 = TkPhotoImage.new(:data=>b_str) -p ph2.configinfo -p ph2.data(:grayscale=>true) - -ph3 = TkPhotoImage.new() -ph3.put(ph2.data(:grayscale=>true)) - -f = TkFrame.new.pack -TkButton.new(:parent=>f, :image=>ph1, :command=>proc{exit}).pack(:side=>:left) -TkButton.new(:parent=>f, :image=>ph2, :command=>proc{exit}).pack(:side=>:left) -TkButton.new(:parent=>f, :image=>ph3, :command=>proc{exit}).pack(:side=>:left) - -Tk.mainloop |