Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Traceback Error
#1
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 ?
Reply
#2
if this is all you got, then you need to import pygame (if you have it installed).
import pygame
...
Recommended Tutorials:
Reply
#3
How to check if I have pygame installed ?
Reply
#4
if you dont know then its most likely not installed.
http://python-gaming.com/pygame/downloads.html
Recommended Tutorials:
Reply
#5
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
>>>
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Traceback Error mg24 2 903 Nov-21-2022, 02:35 PM
Last Post: snippsat
Star python exception handling handling .... with traceback mg24 3 1,215 Nov-09-2022, 07:29 PM
Last Post: Gribouillis
  Traceback error in PyCharm but not in other IDEs? devansing 7 6,254 Mar-05-2020, 11:27 AM
Last Post: buran
  Nameparser - Traceback error tjnichols 2 2,326 Feb-28-2020, 05:11 PM
Last Post: GodMaster
  I have Traceback error and a type error and i dont know how to fix it coltron1282 2 2,468 Feb-07-2019, 03:15 PM
Last Post: coltron1282
  Unexpected output, TypeError and traceback error fier259 2 3,070 May-06-2018, 10:52 PM
Last Post: fier259
  CSV unable to import (traceback error) learnermarx 3 6,292 Feb-09-2018, 03:24 PM
Last Post: buran
  [error]Traceback kikoko_2 1 2,690 Dec-01-2017, 11:30 PM
Last Post: Windspar
  Python Error (Traceback & ValueError) Help! helpplease 4 5,890 Dec-19-2016, 06:07 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020