Ask coding questions

← Back to all posts
Need help with python turtle
Brendan23 (139)

hello person who's reading this. my question is, first, how do I make a function or something that makes it so that when the "player" clicks and/or holds the screen it draws there, and second, how do I make it so that when the "player" presses one of the three color circles at the bottom the "turtle" changes to that color. also, this isn't needed but if your up for it I have one more question, how do I make it so that if the "player" draws in the rectangle at the bottom of the turtle window it doesn't show or it erases.

Comments
hotnewtop
EuanTH (4)

Here's a link to help with the cursor problem, stackoverflow
In summary, it talks about the canvas and binding it to a function, which you can use to bind the mouse position.

For the three coloured circles, you can make 3 different turtles that will draw each of the circles. Each would check if the player is over the circle, and if the player has clicked.

I would recommend to solve this problem in PyGame, it might take some time to learn but it's a lot easier to write applications like this with that module.
There are some great tutorials on YouTube about PyGame, I would recommended this video by Tech with Tim.