PyGameの後継機。
開発環境
インストール
$ pip install pysdl2 Collecting pysdl2 Downloading PySDL2-0.9.6.tar.gz (1.0MB) 100% |████████████████████████████████| 1.1MB 302kB/s Installing collected packages: pysdl2 Running setup.py install for pysdl2 ... done Successfully installed pysdl2-0.9.6
パス
python3.6のvenvでgameという仮想環境を作ってインストールした。SDL2のソースコードは以下の場所に配置される。
/.../game/lib/python3.6/site-packages/sdl2
さらに以下にコード例があった。
/.../game/.../sdl2/examples/
コード例
実行してみた。
$ python helloworld.py

helloworld.pyはsdl2hello.pyと同じ内容にみえた。
ほかのも。
$ python gui.py

$ python pong.py

$ python colorpalettes.py







$ python draw.py

$ python gfxdrawing.py







$ python opengl

$ python particles.py

$ python pixelaccess.py

$ python transfomations.py

所感
思ったより簡単に環境構築できた。実行確認もできた。が、テキスト表示や日本語入力の確認ができていない。