Am 23.01.14 22:56, schrieb DrS:
??? I thought I answered your questions quite clearly. Let me try again.
In fact, there are two parts of it, and I do not understand which one
you want to be answered.
1) How do I draw a Bezier spline arrow in Tk?
2) How do I figure out suitable coordinates to connect boxes with curved
arrows?
======================
Answer to question 1), as in my first post
.c create line $coords -smooth raw
To give you a complete example:
package require Tk
pack [canvas .c -width 200 -height 200]
set coords {50 150 0 50 50 30 150 20}
.c create line $coords -smooth raw -arrow last
======================
Answer to question 2):
Well, you either choose the coordinates manually (by eye). This means,
the first and last of these four points are the endpoints of the arrow,
and the middle two must be placed at a position where you want the arrow
to bend to.
IF you need the computer to figure out the position of these arrows
automatically, just by having the structure of the boxes (a "graph" in
the mathematical sense), then the answer is graphviz. I haven't had a
look at it recently, so I didn't notice that it was blown up to "a giant
graphics package". Previous releases were just a small library in C with
bindings to Tcl which can create such diagrams from graphs automatically.
You can still download, as the bare minimum, "splinomatic"
http://www.graphviz.org/Misc/spline-o-matic/index.html
which is 84kB. Or if you need complete automatic layout, a previous
version of graphviz without all the cairo, gtk and other fancy stuff.
http://www.graphviz.org/pub/graphviz/stable/SOURCES/
As you can see, the first versions where just a few MB, and only
recently they gained weight when dopting 1000 languages, backends and
the web.
>
> My question stands: how did they do it in Tk?
I'm not in the mood to browse through 20 megs of source for you, but it
is available - so why don't you delve into it?
Christian