Home > Net >  Turtle issue with vs code
Turtle issue with vs code

Time:11-03

Hi this is my first time trying to code video games in python. So I found a tutorial video that was ran on the same opperating system as mine (mac) but when I wrote the setup in the video:

#Setup
import turtle

wn=turtle.Screen
wn.title("Pong")
wn.bgcolor("black")
wn.setup(width=800, heigth=600)
wn.tracer(0)

#Main game loop
while True:
    wn.update()

This error appeared:

AttributeError: 'function' object has no attribute 'title'

Does anybody knows what it means and how to fix it? By the way I am running python 3.10.0

CodePudding user response:

of t1 didn't worked try this

#Setup
import turtle

wn=turtle.Screen()#call the Screen like: Screen()
wn.title("Pong")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

#Main game loop
turtle.done()

try to use done instead of update
is it ok??

CodePudding user response:

t1

try this

#Setup
import turtle

wn=turtle.Screen()#call the Screen like: Screen()
wn.title("Pong")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

#Main game loop
while True:
    turtle.update()

does it worked??

  • Related