Python Forum
Python Traceback Error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python Traceback Error (/thread-1009.html)



Python Traceback Error - CaiGengYang - Nov-25-2016

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 ?


RE: Python Traceback Error - metulburr - Nov-25-2016

if this is all you got, then you need to import pygame (if you have it installed).
import pygame
...



RE: Python Traceback Error - CaiGengYang - Nov-25-2016

How to check if I have pygame installed ?


RE: Python Traceback Error - metulburr - Nov-25-2016

if you dont know then its most likely not installed.
http://python-gaming.com/pygame/downloads.html


RE: Python Traceback Error - nilamo - Nov-28-2016

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