From 36692c31cf639a54d93758428e27266a278b0941 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 27 Oct 2014 11:59:11 -0400 Subject: move the "wait for window close" logic into renderfractal --- examples/mandelbrot.jl | 16 ---------------- src/renderer.jl | 7 +++++++ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/examples/mandelbrot.jl b/examples/mandelbrot.jl index 2b9d26d..9bcc818 100644 --- a/examples/mandelbrot.jl +++ b/examples/mandelbrot.jl @@ -9,19 +9,3 @@ imgsize = (640, 480) imgc, imgslice = view([ HSV(0, 0, 0) for y=1:imgsize[2], x=1:imgsize[1] ]) mandelbrot(imgc, iterations) - -#If we are not in a REPL -if (!isinteractive()) - - # Create a condition object - cv = Condition() - - # Get the main window (A Tk toplevel object) - win = toplevel(imgc) - - # Notify the condition object when the window closes - bind(win, "", e->notify(cv)) - - # Wait for the notification before proceeding ... - wait(cv) -end diff --git a/src/renderer.jl b/src/renderer.jl index 7d7fca7..372353a 100644 --- a/src/renderer.jl +++ b/src/renderer.jl @@ -14,6 +14,13 @@ function renderfractal(imgc, iterations, make_c, step) img[new_pixels] = HSV(i * 360/iterations, 1, 1) view(imgc, img) end + + if (!isinteractive()) + cv = Condition() + win = toplevel(imgc) + bind(win, "", e->notify(cv)) + wait(cv) + end end function mandelbrot(imgc, iterations = 45) -- cgit v1.2.3