SHRIRAM POHNEKAR
SHRIRAM POHNEKAR

Reputation: 1

python turtle drawing is not visible, the window stays open but nothing appears on it

I am learning python, I have started on a simple pong game. I have the code to draw two paddles on both sides of the screen the paddles don't appear just a blank screen in the output. Here is the code:

import turtle

#creating a window for pong
win = turtle.Screen()
win.title("PONG")
win.bgcolor("white")
win.setup(width=800, height=600)
win.tracer(0)



#creating paddle A
paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.color("black")
paddle_a.shape("square")
paddle_a.shapesize(stretch_wid=5, stretch_len=1)
paddle_a.penup()
paddle_a.goto(-350,0)


#creating paddle B
paddle_b = turtle.Turtle()
paddle_b.speed(0)
paddle_b.color("black")
paddle_b.shape("square")
paddle_b.shapesize(stretch_wid=5, stretch_len=1)
paddle_b.penup()
paddle_b.goto(350,0)


#ball
ball = turtle.Turtle()
ball.speed(0)
ball.color("black")
ball.shape("square")
ball.penup()
ball.goto(0,0)

win.exitonclick()

PLEASE TELL ME WHERE I AM WRONG!!

Upvotes: 0

Views: 188

Answers (1)

Armali
Armali

Reputation: 19375

If you remove win.tracer(0), the drawn shapes appear. It's unintelligible what you want to achieve with tracer(0), since according to the documentation this means only each zeroth regular screen update is really performed, which is nonsense per se.

Upvotes: 1

Related Questions