From 11dbedfaad4a9a9521ece2198a8dc491678b1902 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 29 Aug 2007 04:06:12 +0000 Subject: add tag v1_8_6_5001 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_6_5001@13304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_1_8_6/ext/tk/sample/binstr_usage.rb | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ruby_1_8_6/ext/tk/sample/binstr_usage.rb (limited to 'ruby_1_8_6/ext/tk/sample/binstr_usage.rb') diff --git a/ruby_1_8_6/ext/tk/sample/binstr_usage.rb b/ruby_1_8_6/ext/tk/sample/binstr_usage.rb new file mode 100644 index 0000000000..91692856f9 --- /dev/null +++ b/ruby_1_8_6/ext/tk/sample/binstr_usage.rb @@ -0,0 +1,39 @@ +#!/usr/bin/env ruby + +require "tk" + +TkMessage.new(:width=>360, :text=><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 -- cgit v1.2.3