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

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-jp/image1.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
#
 
2
# two image widgets demo (called by 'widget')
 
3
#
 
4
 
 
5
# toplevel widget ��¸�ߤ���к������
 
6
if defined?($image1_demo) && $image1_demo
 
7
  $image1_demo.destroy 
 
8
  $image1_demo = nil
 
9
end
 
10
 
 
11
# demo �Ѥ� toplevel widget ������
 
12
$image1_demo = TkToplevel.new {|w|
 
13
  title('Image Demonstration #1')
 
14
  iconname("Image1")
 
15
  positionWindow(w)
 
16
}
 
17
 
 
18
# label ����
 
19
msg = TkLabel.new($image1_demo) {
 
20
  font $font
 
21
  wraplength '4i'
 
22
  justify 'left'
 
23
  text "���Υǥ�Ǥ�2�ĤΥ�٥��˲����򤽤줾��ɽ�����Ƥ��ޤ���"
 
24
}
 
25
msg.pack('side'=>'top')
 
26
 
 
27
# frame ����
 
28
TkFrame.new($image1_demo) {|frame|
 
29
  TkButton.new(frame) {
 
30
    #text 'λ��'
 
31
    text '�Ĥ���'
 
32
    command proc{
 
33
      tmppath = $image1_demo
 
34
      $image1_demo = nil
 
35
      tmppath.destroy
 
36
    }
 
37
  }.pack('side'=>'left', 'expand'=>'yes')
 
38
 
 
39
  TkButton.new(frame) {
 
40
    text '�����ɻ���'
 
41
    command proc{showCode 'image1'}
 
42
  }.pack('side'=>'left', 'expand'=>'yes')
 
43
 
 
44
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
 
45
 
 
46
# image ����
 
47
image1a = \
 
48
TkPhotoImage.new('file'=>[$demo_dir,'..',
 
49
                          'images','earth.gif'].join(File::Separator))
 
50
image1b = \
 
51
TkPhotoImage.new('file'=>[$demo_dir,'..',
 
52
                          'images','earthris.gif'].join(File::Separator))
 
53
 
 
54
# label ����
 
55
[ TkLabel.new($image1_demo, 'image'=>image1a, 'bd'=>1, 'relief'=>'sunken'),
 
56
  TkLabel.new($image1_demo, 'image'=>image1b, 'bd'=>1, 'relief'=>'sunken')
 
57
].each{|w| w.pack('side'=>'top', 'padx'=>'.5m', 'pady'=>'.5m')}
 
58