Ask coding questions

← Back to all posts
Why isn't my code working?
TTyrtle (0)

I am making my own snake game and for some reason when I type this:
import turtle
import time
import random

delay=0.1
score=0
highscore=0

wn = turtle.Screen()
wn.Title("Snake Game")
wn.bgcolor("black")
wn.setup(width=600, height=600)
wn.tracer(0)

It doesn't work. It says:

AttributeError: 'Screen' object has no attribute 'Title' on line 11

Could anybody help me figure out what is wrong?

Commentshotnewtop
OlauPla (154)

You have to use it like this:

screen.title('text')

Hope it helped! ((:

Coder100 (11137)

try using this language instead.

Also, if you think there is a mistake, feel free to report this to bugs. Thanks!

TTyrtle (0)

@Coder100 will the code I currently have still work for that language?

Coder100 (11137)

yes, it's the same language (python), just with different setup @TTyrtle

TTyrtle (0)

@Coder100 ok new problem. Whenever i run the code (the exact same code) it says:

 bash -c polygott-x11-vnc q && DISPLAY=:0 run-project
....Traceback (most recent call last):
File "main.py", line 18, in <module>
head.shape('shape')
File "/usr/lib/python3.8/turtle.py", line 2776, in shape
raise TurtleGraphicsError("There is no shape named %s" % name)
turtle.TurtleGraphicsError: There is no shape named shape
exit status 1

I have used python before but never pygame

Coder100 (11137)

send repl,
ok, so a pygame repl actually works with turtle too, it's not strictly for pygame, it's just set up so things like pygame work. You could run a normal python script in it just fine because pygame is python. @TTyrtle

TTyrtle (0)

so you want me to jsut share that repl with you? ok
@Coder100

Coder100 (11137)

ok, there was no shape called shape lol, did you mean square? anyways its mostly fixed now @TTyrtle

SixBeeps (3221)

title should be all lowercase

TTyrtle (0)

@SixBeeps it still has the same issue, but this time title is lowercase