pygameの対応は大昔に終わっている
python3系への対応はされておらず、既に時代遅れとなっているpygameだが、pysdl2はpygameほど手軽ではなく、それほどまで厚いラッパーではない
今回は単純なものを素早く作りたかったので、pygameをpython3系で使うことにした。
ちなみに、2系でもこの方法でのダウンロードがいいらしいです。
インストール
まずは必要物のインストール
インストール
brew install mercurial
brew install git
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
次にpipを使ってpygameをインストール
pip install hg+http://bitbucket.org/pygame/pygame
まさかgui側からこんなふうに出てくるとは思わなかったが、指示に従い依存関係の解決をした。
確認
かくにん
>>> 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()
動いたし問題無い あります
どうやらKEY関連のイベントがうまくいかないらしいです。
3系だとpysdl2に手を出す他ないようです…