Cody Bable

Generation

generate functionFri, 28 Apr 2023

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

import turtle def draw_line(x, y): global mouse_actions mouse_actions.append((x, y)) turtle.goto(x, y) def main(): global mouse_actions mouse_actions = [] turtle.onscreenclick(draw_line) turtle.mainloop() main()

Questions about programming?Chat with your personal AI assistant