File: example_fraction.tcl

package info (click to toggle)
r-cran-tcltk2 1.2-10-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,356 kB
  • ctags: 1,386
  • sloc: tcl: 37,888; ansic: 792; python: 324; sh: 68; sed: 16; makefile: 1
file content (29 lines) | stat: -rwxr-xr-x 550 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
source ./draw_diagram.tcl
#package require Diagrams
namespace import ::Diagrams::*

pack [canvas .c -width 300 -height 80 -bg white]
drawin .c

direction east
currentpos [position 20 40]
box "A"
plaintext "divided by"
box "A+B"
plaintext " "
arrow "" 20
plaintext "      "
set pos [currentpos]
lset pos 2 15

direction south
currentpos $pos
plaintext "A"
usegap 0
set xc [lindex [currentpos] 1]
set xb [expr {$xc-15}]
set xe [expr {$xc+15}]
.c create line $xb [lindex [currentpos] 2] $xe [lindex [currentpos] 2]
plaintext "A+B"

#saveps fraction.eps