メニュー

pygame.locals

pygameで使用する定数群

    このモジュールにはPygameで使用される様々は定数が定義されています。 これらは自動的にpygameモジュールの名前空間に読み込まれますが、プログラムでpygame.localsで定義された定数を使用するには'from pygame.locals import *'と記載して定数を読み込む必要があります。

    各定数の詳細な説明についてはPygameドキュメントの該当項目を参照してください。 HWSURFACE定数のようにpygame.display.set_mode命令で使用されるものは、 Displayの項目に詳細が記載されています。各 Eventの種類についても、Event項目で詳しく説明されています。KEYDOWNイベントやKEYUPイベントに関連するK_定数については、Keyの項目に一覧が記載されています。修飾キーに関するMOD_定数についても同じKeyの項目に記載されています。最後に、TIMER_RESOLUTION定数についてはTimeの項目に説明が載っています。

    ※原文には「TIMER_RESOLUTION is defined in Time.」と記載されており「TIMER_RESOLUTION定数はpygame.timeに定義されている」とも読み取れますが、動作を確認したところTIMER_RESOLUTION定数がpygame.localsに定義されているのは間違いないようなので「TIMER_RESOLUTION定数についてはTimeの項目に詳しい説明が載っている。」という意味で訳しています。

    pygame constants

      This module contains various constants used by Pygame. It's contents are automatically placed in the pygame module namespace. However, an application can use pygame.locals to include only the Pygame constants with a 'from pygame.locals import *'.

      Detailed descriptions of the various constants are found throughout the Pygame documentation. pygame.display.set_mode flags like HWSURFACE are found in the Display section. Event types are explained in the Event section. Keyboard K_ constants relating to the key attribute of a KEYDOWN or KEYUP event are listed in the Key section. Also found there are the various MOD_ key modifiers. Finally, TIMER_RESOLUTION is defined in Time.