~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/tkextlib/blt/winop2.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
require 'tk'
 
3
require 'tkextlib/blt'
 
4
 
 
5
file = File.join(File.dirname(File.expand_path(__FILE__)), 
 
6
                 'images', 'qv100.t.gif')
 
7
if File.exist?(file)
 
8
  src = TkPhotoImage.new(:file=>file)
 
9
else
 
10
  fail RuntimeError, 'no image file'
 
11
end
 
12
 
 
13
width = src.width
 
14
height = src.height
 
15
 
 
16
TkOption.add('*Label.font', '*helvetica*10*')
 
17
TkOption.add('*Label.background', 'white')
 
18
 
 
19
[0, 90, 180, 270, 360, 45].each_with_index{|r, i|
 
20
  dest = TkPhotoImage.new
 
21
  Tk::BLT::Winop.image_rotate(src, dest, r)
 
22
  l_txt = TkLabel.new(:text=>"#{r} degrees")
 
23
  l_img = TkLabel.new(:image=>dest)
 
24
  Tk::BLT::Table.add(Tk.root, [0,i], l_img, [1,i], l_txt)
 
25
  Tk.update
 
26
}
 
27
 
 
28
Tk.mainloop