H
H
harris2020-08-05 17:38:06
Python
harris, 2020-08-05 17:38:06

Error name error name is not defined, what should I do?

Here is the complete error:

File "game.py", line 5, in
pygame.display.set_caption(game)
NameError: name 'game' is not defined

Here is the code:
import pygame

pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption(game)

run = True
while(True):
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      run = False

pygame.quit()

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
soremix, 2020-08-05
@SoreMix

The variable game is not defined, what can we say

N
Nick, 2020-08-05
@c00re

You need to write the name of your game in brackets in the line pygame.display.set_caption

A
Alan Gibizov, 2020-08-05
@phaggi

Start by reading the documentation:
1. Documentation for the resource where you post the question. You broke a whole bunch of rules at once.
2. Documentation for the language in which you write the program.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question