python-turtle

How to fix a RecursionError in Turtle?

How to fix a RecursionError in Turtle? Question: I’m trying to write a program with Python to emulate an ‘old’ online game in which you drive a worm through the screen with some inputs from the keyboard. import turtle # Set screen and background wn = turtle.Screen() wn.title("Turn with Left and Right buttons your keyboard. …

Total answers: 2

How can i print random color circles in turtle?

How can i print random color circles in turtle? Question: the below code is one part of my code. I would like to print random colored circles. But it does not work. Can someone please help me to correct this code? circles shouldnt be overalapped!! ERROR is bad color sequence: (164, 13, 120) from random …

Total answers: 1

How do I make the Turtle drawing speed faster?

How do I make the Turtle drawing speed faster? Question: How can I make the Python library Turtle, run and draw a square in 1 screen tick? import turtle as t import math def square(): t.penup() t.goto(cord_x_1, cord_y_1) t.pendown() t.goto(cord_x_2, cord_y_2) t.goto(cord_x_3, cord_y_3) t.goto(cord_x_4, cord_y_4) t.goto(cord_x_1, cord_y_1) t.penup() t.speed(0) theta = 0 print("What do you …

Total answers: 2

Is there a way to run a boolean if statement in Python Turtle?

Is there a way to run a boolean if statement in Python Turtle? Question: I’m editing a Turtle Pong template and realized that two paddles can’t move at the same time, so I’m trying to fix that bug by having it so, when a key is pressed, a boolean is set to true, and that …

Total answers: 1

How to draw a polygon given a number of points with Turtle()?

How to draw a polygon given a number of points with Turtle()? Question: I have a list of points given by (x, y) coordinates, and I want to connect them in a polygon shape. For example: import turtle tina = turtle.Turtle() tina.shape(‘turtle’) points = [ (40, -80), (30, -80), (30, -70), (40, -70) ] Is …

Total answers: 1

Turtle graphics – screen updates with tracer not working as expected

Turtle graphics – screen updates with tracer not working as expected Question: I’m trying to put in scheduled refreshes for a pong game, so the screen updates after a time interval so the paddles (which I have segmented) move in sync on the screen. What is the functional difference between these two blocks of code? …

Total answers: 1

Is there any way to change the outline size of a turtle compound shape?

Is there any way to change the outline size of a turtle compound shape? Question: I am trying to create a compound shape. What I want now is to change the outline size of this new compound shape. I have made the shape like this: import turtle points_1 = […] # list of points points_2 …

Total answers: 1

How to make a tiebreaker on Turtle Race?

How to make a tiebreaker on Turtle Race? Question: Hey guys I am doing the turtle race module on 100 days of code and I have been able to get it to work so far. However I am having trouble coding a tiebreaker function into it. I used boolean based "if" statements to make a …

Total answers: 1

Trying to create two objects at the same time but it creates one

Trying to create two objects at the same time but it creates one Question: I’m trying to develop a simple game while I’m learning python. Game is not complex, random cars (which are squares) are spawning at right of the screen and they are going to left. We are a turtle, trying to avoid them …

Total answers: 1