Forum Archive

Previous canvas drawings persist

vdomeras

On my iPad the console shows the results of previous runs of my code plus that of the current version after an edit. That is, I draw a graphic and it appears in the console, then I change the code and run. The drawing now includes all previous runs as well as new one. I found that restarting the iPad does clear old results. Any ideas?

cvp

@vdomeras begin each script with console.clear()

vdomeras

@cvp No luck, but thanks for the reply.

cvp

@vdomeras I'm estonished or I don't understand your problem.
What is your code to display a graphic in console?

cvp

@vdomeras understood, same problem. I never use canvas module, sorry.

cvp

@vdomeras begin with canvas.clear()

vdomeras

@cvp

from math import pi, sin, cos, radians, degrees
import canvas, console

w = h = 600
wc = hc = 300
i = 1
r = 200

console.clear()
canvas.set_stroke_color(1, 0, 0)
canvas.set_line_width(5)
while i in range(0, 360):
    angle = radians(i)
    x = wc + r * sin(angle)
    y = hc + r * cos(angle)
    canvas.draw_line(wc, hc, x, y)
    i = i + 20