Cody Bable

Generation

generate functionFri, 28 Apr 2023

create a function to store the mouse clicks and redraw from the mouse clicks in turtle.

point = [] def add(x,y): point.append([x,y]) turtle.clear() turtle.penup() turtle.goto(x, y) turtle.pendown() turtle.dot(3, "red") def draw(): for i in point: x = i[0] y = i[1] turtle.penup() turtle.goto(x, y) turtle.pendown() turtle.dot(3, "red") turtle.onscreenclick(add, btn = 1) turtle.onkey(draw, "space")

Questions about programming?Chat with your personal AI assistant