Pygame is not compatible with python3 series and is already outdated, but pysdl2 is not as easy as pygame and it is not a thick wrapper.
This time I wanted to make something simple quickly, so I decided to use pygame with python3 series.
By the way, it seems that downloading by this method is good even for 2 series.
First of all, installation of necessary items
Installation
brew install mercurial
brew install git
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
Then install pygame using pip
pip install hg+http://bitbucket.org/pygame/pygame
During the installation with pip, this came out
I didn't expect it to come out like this from the gui side, but I followed the instructions to resolve the dependency.
Verification
>>> import pygame
>>> pygame.init()
2016-06-01 02:46:59.521 python3[55786:2013267] 02:46:59.521 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
(6, 0)
>>> pygame.display.set_mode((500, 500))
<Surface(500x500x32 SW)>
>>> exit()
It works and there is a problem ~~ no ~~
Apparently the KEY related event is it doesn't seem to work.
It seems that there is no choice but to touch pysdl2 with 3 series ...
Recommended Posts