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

« back to all changes in this revision

Viewing changes to ext/tk/sample/tcltklib/lines2.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/local/bin/ruby
 
2
 
 
3
require "tk"
 
4
 
 
5
def drawlines()
 
6
  print Time.now, "\n"
 
7
 
 
8
  for j in 0 .. 99
 
9
    print "*"
 
10
    $stdout.flush
 
11
    if (j & 1) != 0
 
12
      col = "blue"
 
13
    else
 
14
      col = "red"
 
15
    end
 
16
    for i in 0 .. 99
 
17
#      TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
 
18
    end
 
19
  end
 
20
 
 
21
  print Time.now, "\n"
 
22
 
 
23
  for j in 0 .. 99
 
24
    print "*"
 
25
    $stdout.flush
 
26
    if (j & 1) != 0
 
27
      col = "blue"
 
28
    else
 
29
      col = "red"
 
30
    end
 
31
    for i in 0 .. 99
 
32
      TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
 
33
    end
 
34
  end
 
35
 
 
36
  print Time.now, "\n"
 
37
#  Tk.root.destroy
 
38
end
 
39
 
 
40
$a = TkCanvas.new{
 
41
  height(500)
 
42
  width(500)
 
43
}
 
44
 
 
45
$b = TkButton.new{
 
46
  text("draw")
 
47
  command(proc{drawlines()})
 
48
}
 
49
 
 
50
TkPack.configure($a, $b, {"side"=>"left"})
 
51
 
 
52
Tk.mainloop
 
53
 
 
54
# eof