0

so i wanted to make a game...and pygame doesn't seem to be working for me. I get this error, "

AttributeError: module 'pygame' has no attribute 'init'"

and ive tried every other forum and cant find help...my game is called roll and I'm using the correct pygame. What do i do?

import pygame
pygame.init()

gamedisplay = pygame.display.set_mode((800,600))
pygame.display.set_caption('roll.io')
clock = pygame.time.Clock()

dead = False

while not dead:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            dead = True

        print(event)

    pygame.display.updat()
    clock.tick(30)

pygame.quit()
quit()
6
  • Is your file called pygame.py, or do you have any files other than PyGame itself called pygame.py? Commented May 15, 2016 at 8:34
  • Are you using the latest version of pygame? Commented May 15, 2016 at 8:34
  • what does pygame.__path__ print? Commented May 15, 2016 at 8:35
  • nope... soryy but ive tried that Commented May 15, 2016 at 8:36
  • Multiple similar questions suggested that you might have some conflict with pygame name; refer: stackoverflow.com/questions/5960206/…, stackoverflow.com/questions/19912810/pygame-attribute-init Commented May 15, 2016 at 8:37

2 Answers 2

0

I've also had some trouble installing pygame for the latest python version, mostly because all guides are either old or don't support the latest python version. So this is what worked for me:

First download(I uploaded it for you because I can't even find the place I originally downloaded it from...) it from here then copy the file and paste it into [your python folder]/scripts, then open cmd type cd [location of your script folder] and finally type pip3 install pygame-1.9.2a0-cp35-none-win32.whl and don't try to rename it to a shorter file name because for some reason it won't work.

Sign up to request clarification or add additional context in comments.

Comments

0

Have you tried including

    from pygame.locals import *

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.