-2

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

  • `turtle.Screen` is a function. `turtle.Screen()` **calls** the function and gives you back a window object that has the methods you're trying to call on it. – Ted Klein Bergman Nov 02 '21 at 14:56

2 Answers2

-1

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??

ItsMe
  • 395
  • 2
  • 13
-1

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??

ItsMe
  • 395
  • 2
  • 13