On Friday, April 15, 2016 at 6:35:15 PM UTC+2, Christoph Ortner wrote:
>
> many tanks for this - that looks perfect.
>
> unfortunately my Gtk installation seems broken, so it will be a while
> until I can try this out.
>
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.4-pre+218 (2016-01-29 21:53 UTC)
_/ |\__'_|_|_|\__'_| | Commit 386d77b* (76 days old release-0.4)
|__/ | x86_64-linux-gnu
julia> using Tk
julia> using Compose
julia> w = Tk.Window("a-title",100,200);
julia> c = Tk.Canvas(w, 100,200);
julia> Tk.pack(c, expand = true, fill = "both")
""
julia> function sierpinski(n)
if n == 0
compose(context(), polygon([(1,1), (0,1), (1/2, 0)]))
else
t = sierpinski(n - 1)
compose(context(),
(context(1/4, 0, 1/2, 1/2), t),
(context( 0, 1/2, 1/2, 1/2), t),
(context(1/2, 1/2, 1/2, 1/2), t))
end
end
sierpinski (generic function with 1 method)
julia> co = sierpinski(3);
julia> Compose.draw(CAIROSURFACE(c.back),co)
julia> Tk.draw(c)
is not self-updating (i'm really no tk expert (anymore)) and you need to do
all drawing i.e. providing an empty background but at least you get
something on screen. As Winston ws longer time Tk only, there should be
signal handling code.