0

I'm trying to make a snake game on Python 3 and keep getting this error when trying to use the TK module for the snake game. In my coding I'm only on the first stage of the coding of the game so I haven't done much but I just wanted to use the TK module and it wasn't really working I'm not sure what to do. It would be really helpful if someone could answer this question.

GAME_WIDTH = 700
GAME_HIGH = 700
SPEED = 50
SPACE_SIZE = 50
BODY_PARTS = 3
SNAKE_COLOUR = "#00FF00"
FOOD_COLOUR = "#FF0000"
BACKGROUND_COLOUR = "#000000"


class snake:
    pass

class food:
    pass

def next_turn():
    pass


def change_direction(new_direction):
    pass

def check_collisions():
    pass

def game_over():
    pass


window = Tk()
window.title("Snake Game")
window.resizable(False,False)
window.mainloop()
  • 1
    Surely the site where you got this must have advised you to `from tkinter import Tk`. Or `from tkinter import *`. – Tim Roberts Aug 29 '22 at 03:32
  • "but I just wanted to use the TK module" Then you need to `import` it first. If you are not familiar with the `import` keyword, please try to follow a tutorial and learn the fundamentals before trying to create graphical programs. – Karl Knechtel Aug 29 '22 at 03:35

0 Answers0