import turtle #NO DOUBLE CLICKING: EXPERIMENT WITH ONCLICK AND ONRELEASE, with a square background turtle :D wn = turtle.Screen() bg = turtle.Pen() p = turtle.Pen() bg.goto(0,0) bg.color("") bg.shape("square") bg.turtlesize(250,250,0) p.speed(0) p.up() SIZE_P = 1 SIZE_E = 20 i = 0 j = 0 #col def eup(): global SIZE_E SIZE_E += 5 p.width(SIZE_E) def edown(): global SIZE_E if SIZE_E > 0: SIZE_E -= 5 p.width(SIZE_E) def pup(): global SIZE_P SIZE_P += 1 p.width(SIZE_P) def pdown(): global SIZE_P if SIZE_P > 0: SIZE_P -= 1 p.width(SIZE_P) def size(): print("Eraser:", SIZE_E) print("Pen:", SIZE_P) def modep(): print("Mode: Pen") wn.onkeypress(pup,"Up") wn.onkeypress(pdown,"Down") p.color("black") p.shape("triangle") p.width(SIZE_P) def modee(): print("Mode: Eraser") wn.onkeypress(eup,"Up") wn.onkeypress(edown,"Down") p.pencolor("white") p.shape("circle") p.width(SIZE_E) def rest(a,b): bg.onrelease(None) p.up() bg.onrelease(rest) global i print("release", i) i += 1 #or, on 1st instance of ondrag, goto cursor. however may appear as lag(done?) def draw(a,b): bg.ondrag(None) p.goto(a,b) if not p.isdown(): global j p.down() print("start", j) j += 1 bg.ondrag(draw) def reset(): global SIZE_E, SIZE_P SIZE_E = 20 SIZE_P = 1 p.reset() p.up() p.speed(0) def clear(): p.clear() modep() bg.onrelease(rest) bg.ondrag(draw) wn.onkey(modee,"e") wn.onkey(modep,"p") wn.onkey(size, "s") wn.onkey(reset, "r") wn.onkey(clear, "c") #print(p.isdown()) wn.listen() wn.mainloop() #lol perhaps i shld use the while true thing