[ How to use Pygame with PyCharm on Windows? ]
I use PyCharm on Windows with Python 2.7 interpreter. I'd like to write a GUI using pygame. So I downloaded the package pygame-1.9.1.win32-py2.7.msi from the website: http://www.pygame.org/download.shtml
However, when I try running the following code:
from pygame.locals import *
screen = pygame.display.set_mode((1024, 768))
The pygame package is still unrecognized - it is underlined as an error. However, it is visible as an installed package in the settings.
How can I fix it?
Edit1: import pygame
doesn't help.
Here is the error:
WARNING:root:No virtualenv active File "C:/Users/User/Python/Project/Game/main.py", line 1 SyntaxError: Non-ASCII character '\xa0' in file C:/Users/User/Python/Project/Game/main.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Answer 1
Try to use:
import pygame
instead
import pygame.locals import *
Or show the error