Questions tagged [python-turtle]
The python turtle module is builtin and provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. It's based around tkinter, a UI library built into many Python distributions.
python-turtle
1,497
questions
-1
votes
0
answers
28
views
How do I add depth to my Pentagonal trapezohedron?
The shape unintentionally looks like an optical illusion, which was not my intended effect. I don't know what the best approach to this is. I wanted to add some depth with shadows, but I don't know if ...
0
votes
2
answers
74
views
Why does the turtle not move in a square? [duplicate]
How do I move this, and make a square a proper position.
import turtle
def draw_square():
window = turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape(&...
0
votes
0
answers
20
views
my paddle is not responding towards keys, Why? [duplicate]
i am building a pong game using python and my paddle is not responding towards keys. Why?
It's showing error
TypeError: unsupported operand type(s) for -: 'method' and 'int'
from turtle import Screen, ...
0
votes
1
answer
48
views
Why do the options not appear for my Snake game?
I am creating the snake game with a twist. I want questions to appear on top and their answers to appear randomly on the screen.
I am using turtle and creating classes while retrieving the question ...
1
vote
0
answers
37
views
Collision failed in turtle graphics ping-pong game: the ball is not bouncing after it hits the wall
I wrote a collision function to make the ball bounce back after it hits the wall. It's called wall_collision in ball.py.
Issue
The collision function called wall_collision does not work as expected:
...
1
vote
1
answer
39
views
Dynamically passing Turtles to onkeypress() binds always only one of them
I'm working with Turtle, recreating the pong game as part of an intro course.
I have 2 turtle objects, called paddles, stored in a dict with the relevant keys to move them, see below.
I'm trying using ...
0
votes
3
answers
65
views
Can we use commands as a parameters? [duplicate]
I want to use the commands as parameters in a function.
Is there any way ?
import turtle as t
pen=t.Turtle
def orders(name,var) :
pen.name(var)
orders(forward,50)
orders(right,90)
t.done()
I ...
0
votes
0
answers
25
views
Second instance of a class suppresses/deletes the first one in my Python program [duplicate]
I am creating the Pong game using the Turtle module in Python. So far, I have one file for the paddles (the bars that players control to hit the ball) called paddles.py and a second file for the main ...
2
votes
1
answer
45
views
Why is the bat/board not moving up or down in the Pong Game, when the screen.listen() is called using the Turtle module in Python?
Using the turtle module to make a pong game. For this part, when I press the up/down keys the board doesn't respond to the onkey listen function.
I created the board/bat (or bat specs function from ...
1
vote
1
answer
77
views
I am trying to make a snake game using the Python Turtle graphics, but it ends as soon as it starts [closed]
I'm not too sure what is wrong, as I tried to cross check with the code given in the course that I am taking. The issue comes up when I try to add the code for the collision with its own tail. If I ...
0
votes
0
answers
27
views
How to use distance between stretched objects in turtle python
I'm working on making a pong game as an exercise, and i'm trying to handle the ball direction after it hits the paddle, I want the ball to go straight if it hits the center of the paddle and to go up ...
-2
votes
1
answer
65
views
How to use turtle.distance(x) over members of a list of turtles? [duplicate]
I'm trying to do collision detection over the members of a list of turtles, so that a variable returns a Boolean to break a while true loop. It works with ONE of the turtles, but not the others. It ...
1
vote
1
answer
45
views
Python Turtle Module, inheriting from Screen-class, function() argument 'code' must be code, not str
I am currently programming a Pong game in Python. For this, I am using the Python Turtle module. In the Pong game, the main idea is that there are two paddles (one on the left, one on the right) that ...
0
votes
1
answer
32
views
Python Turtle - Exception has occurred: Terminator exception: no description
I am having trouble with running this code. I am trying to run an instance of turtle, successfully close it, and start a new instance of the turtle. I am able to complete the first iteration but I get ...
0
votes
2
answers
39
views
Taking input from turtle module in python
import turtle as tu
turtle = tu.Turtle()
turtle.color("cyan1")
turtle.shape("turtle")
square_len = tu.textinput("Square Lenght", "Lenght")
def draw_square():
...