gale.conf package
gale.conf: a lazily-loaded, overridable settings object (named “gale.conf” rather than “gale.settings” so it never collides with a project’s own top-level settings.py).
from gale.conf import settings gives you a single object with every setting gale.game.Game understands (see gale.conf.global_settings for the full list and their defaults). On first access, it tries import settings – the project’s own top-level settings.py, importable because gale games are always run from their own directory – and looks up each attribute there first, falling back to gale.conf.global_settings for anything the project doesn’t define. This also means a project’s settings.py can define its own extra settings (asset dicts, gameplay constants, …) and read them back the same way, with no special declaration needed.
Author: Alejandro Mujica (aledrums@gmail.com)
- class gale.conf.Settings[source]
Bases:
objectSee the module docstring. Usage example:
# settings.py, next to main.py WINDOW_WIDTH = 1280 WINDOW_HEIGHT = 720 PLAYER_SPEED = 200
# main.py from gale.conf import settings
settings.WINDOW_WIDTH # 1280: the project’s own override settings.FPS # 60: gale.conf.global_settings’ default settings.PLAYER_SPEED # 200: a project-specific setting, not
# declared anywhere in gale itself