Debian Codegraph @

demos/bgexec2.tcl

raw
1 #!../src/bltwish
2
3 package require BLT
4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own
6 # namespace called "blt". The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.
9 #
10 # You can access the BLT commands in a couple of ways. You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
12 #
13 # blt::graph .g
14 # blt::table . .g -resize both
15 #
16 # or you can import all the command into the global namespace.
17 #
18 # namespace import blt::*
19 # graph .g
20 # table . .g -resize both
21 #
22 # --------------------------------------------------------------------------
23
24 if { $tcl_version >= 8.0 } {
25 namespace import blt::*
26 namespace import -force blt::tile::*
27 }
28
29 source scripts/demo.tcl
30
31 proc ShowResult { name1 name2 how } {
32 global var
33 .l$name2 configure -text "$var($name2)"
34 after 2000 "table forget .l$name2"
35 }
36
37 for { set i 1 } { $i <= 20 } { incr i } {
38 label .l$i
39 table . .l$i $i,0
40 set pid [bgexec var($i) du /usr/include &]
41 .l$i configure -text "Starting #$i pid=$pid"
42 trace variable var($i) w ShowResult
43 update
44 after 500
45 }
46