Panda3D Config
Experimental library. Not suitable for production use.
Configuration utilities for the Panda3D game engine. Provides a convenient wrapper around Panda3D's configuration system with support for declaring typed variables, validation, change notifications, and loading/saving user settings from files.
Features
- Typed variable declarations — Declare config variables with explicit types (
bool,int,double,string) and default values. - Validation — Automatic type validation on set, with support for custom per-variable validators.
- Change notifications — Messenger events are sent when variables change, making it easy to react to config updates at runtime.
- Load/Save — Read and write configuration files in Panda3D's native format, with optional human-readable descriptions.
- Restart tracking — Mark variables that require a restart, so your UI can inform users when a restart is needed.
- Built-in ShowBase config —
ShowBaseConfigprovides pre-declared variables for common graphics, window, and audio settings.
Installation
pip install panda3d-config
Dependencies
Quick Start
Custom configuration
from panda3d import core as p3d
from panda3d_config import PandaConfig
config = PandaConfig("MyGame")
# Declare variables with type and default value
config.declare_variable("music-volume", "0.8", p3d.ConfigFlags.VT_double)
config.declare_variable("show-hud", "true", p3d.ConfigFlags.VT_bool)
config.declare_variable("difficulty", "1", p3d.ConfigFlags.VT_int, restart_required=True)
# Get and set values
config.set("music-volume", "0.5")
value = config.get("music-volume") # "0.5"
# Save to file
config.save("settings.config")
# Load from file
config.load("settings.config")
Using ShowBaseConfig
ShowBaseConfig comes with pre-declared variables for common Panda3D settings like display mode, window size, fullscreen, anti-aliasing, texture filtering, and audio.
from panda3d_config import ShowBaseConfig
settings = ShowBaseConfig()
# Configure before creating ShowBase
settings.set("win-size", "1920 1080")
settings.set("fullscreen", "true")
settings.set("multisamples", "4")
settings.set("framebuffer-multisample", "true")
# Save user preferences
settings.save("user-settings.config")
Changes to win-size and fullscreen are applied to the window automatically at runtime if ShowBase is already running.
Custom validation
Define a method named <variable>_validate (with hyphens replaced by underscores) on a PandaConfig subclass to add custom validation logic:
class GameConfig(PandaConfig):
def __init__(self):
super().__init__("GameConfig")
self.declare_variable("difficulty", "1", p3d.ConfigFlags.VT_int)
def difficulty_validate(self, value: str) -> bool:
return int(value) in range(0, 4)
Listening for changes
from direct.showbase.DirectObject import DirectObject
class SettingsUI(DirectObject):
def __init__(self):
super().__init__()
self.accept("music-volume-config-value-changed", self.on_volume_changed)
def on_volume_changed(self, value: str):
print(f"Volume changed to {value}")
License
This project is licensed under the MIT License — see the LICENSE file for details.
Release files for panda3d-config 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| panda3d_config-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / panda3d_config-0.0.0-py3-none-any.whl
| Download URL | panda3d_config-0.0.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0cd0ec13d00c52a7eb8aaa9f3ef47e73997e025e668fc3af220007f213d34c6
|
|
BLAKE2b-256 checksum How to use checksums |
5c080c183456d413a540809b4436187e54ca394b686b7a6453146c378bd351a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency log