home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!wupost!cs.utexas.edu!tamsun.tamu.edu!inetg1!cgp
- From: cgp@Arco.COM (Chris Phillips (214) 754-6419)
- Subject: canvas problem
- Message-ID: <1992Aug18.023804.25826@Arco.COM>
- Organization: ARCO Oil and Gas Company
- Date: Tue, 18 Aug 1992 02:38:04 GMT
- Lines: 44
-
- For some reason the following script doesn't give the expected results.
- It creates two canvases: one horizontal and one vertical. They should
- each create 10 squares, all in a row. The horizontal canvas is ok, but
- only 2 squares show up in the vertical canvas.
-
-
- #!/usr/local/bin/wish -f
-
- proc trash {w doy} {
- toplevel $w
- if {$doy == 1} {
- canvas $w.c -width 1c -height 10c
- $w.c create rectangle 0 0 1c 10c -fill red
- for {set j 1} {$j <= 10} {incr j} {
- $w.c create rectangle \
- 0 [expr $j-1]c 1c ${j}c \
- -outline black -fill blue
- }
- } else {
- canvas $w.c -width 10c -height 1c
- $w.c create rectangle 0 0 10c 1c -fill red
- for {set i 1} {$i <= 10} {incr i} {
- $w.c create rectangle \
- [expr $i-1]c 0 ${i}c 1c \
- -outline black -fill blue
- }
- }
-
- pack append $w $w.c {expand fill}
- }
-
- trash .t0 0
- trash .t1 1
- message .m -text "Horizontal: 10 blue squares\nVertical: 2 blue squares" \
- -aspect 1500 -justify center
- pack append . .m {expand fill}
-
-
- ----- End script -----
-
-
- Any ideas?
-
- Chris
-