Python Forum

Full Version: Python Traceback Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
pygame.draw.rect(screen, BROWN, [60, 400, 30, 45])
Error:
Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) NameError: name 'pygame' is not defined
How to solve this error ?
if this is all you got, then you need to import pygame (if you have it installed).
import pygame
...
How to check if I have pygame installed ?
if you dont know then its most likely not installed.
http://python-gaming.com/pygame/downloads.html
That's easy. Try to import it. If you get an error, then it's not installed.
C:\Users\this-guy\Documents\etc>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>>