@JimSkon/

TurtleMouseClickExample

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import turtle     
import random        
wn = turtle.Screen()      
wn.bgcolor('lightblue')
svea = turtle.Turtle()

def square(t,size):
  for i in range(4):
    t.forward(size)
    t.right(90)

def drawOnClick(x,y):
  svea.up()
  svea.goto(x,y)
  svea.down()
  square(svea,30)

wn.onclick(drawOnClick)

result
console