Reputation: 187
Below is the error I am receiving and the code I have written. I know similar questions have been asked , but the solutions they are given do not relate to this case. And I can't seem to figure out why I am receiving this attribute error. I am running python 3.3 and pygame. The OS im on is ubuntu 12.10. I hope someone can find a solution to this problem so I can continue working on this physics simulation.
Traceback (most recent call last):
File "/media/lawton/D4B1-5B96/programming/Python/gamephysics.py", line 9, in <module>
screen = pygame.display.set_mode((width, height))
AttributeError: 'module' object has no attribute 'display'
import pygame
background_colour = (255,255,255)
(width, height) = (300, 200)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tutorial 1')
screen.fill(background_colour)
pygame.display.flip()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT():
running = False
Upvotes: 0
Views: 2125
Reputation: 1121486
You are shadowing the pygame
library with another pygame.py
file, probably in the same location as gamephysics.py
.
Print out the file path of the offending module:
import pygame
print('Path to pygame module:', pygame.__file__)
This will you show you where the 'rogue' module is located. Once you find it, rename it to something else.
Upvotes: 2