Skip to content

AppSettings

Application-wide settings for bootstack applications.

This dataclass holds configuration for theming, localization, and application metadata. It is automatically populated with sensible defaults based on the system locale.

Attributes:

Name Type Description
app_name str | None

The application name displayed in the title bar.

app_author str | None

The application author (used for config paths).

app_version str | None

The application version string.

theme str

The current theme name ('light', 'dark', or a specific theme).

light_theme str

The theme to use when theme='light'.

dark_theme str

The theme to use when theme='dark'.

follow_system_appearance bool

If True, automatically switch between light_theme and dark_theme to match the OS appearance and track changes at runtime. Currently effective on macOS, where Tk fires <<TkSystemAppearanceChanged>> and exposes the current mode via tk::unsupported::MacWindowStyle isDark. Defaults to False so existing apps that pin a theme keep doing so.

available_themes Sequence[str]

Sequence of available theme names.

inherit_surface_color bool

If True, child widgets inherit the parent's surface color for consistent backgrounds.

locale str | None

The locale identifier (e.g., 'en_US', 'de_DE'). Auto-detected from system if not specified.

language str | None

The base language code (e.g., 'en', 'de'). Derived from locale if not specified.

date_format str | None

The date format pattern. Derived from locale if not specified (e.g., 'M/d/yy' for en_US).

time_format str | None

The time format pattern. Derived from locale if not specified (e.g., 'h:mm a' for en_US).

number_decimal str | None

The decimal separator character. Derived from locale if not specified (e.g., '.' for en_US).

number_thousands str | None

The thousands separator character. Derived from locale if not specified (e.g., ',' for en_US).

localize_mode LocalizeMode

Controls localization behavior. 'auto' enables localization based on locale, True always enables, False disables.

window_style str | None

Windows-only pywinstyles effect for all windows. Options include 'mica', 'acrylic', 'aero', 'transparent', 'win7'. Defaults to 'mica'. Set to None to disable.

macos_quit_behavior str

How the close button and Cmd+Q behave on macOS. 'native' (default) follows Mac convention: clicking the window close button or Cmd+H hides the app (withdraws), clicking the dock icon reshows it, and Cmd+Q (or Dock → Quit) actually destroys it. 'classic' restores the cross-platform behavior where the close button destroys the window. No-op on Win/Linux.

remember_window_state bool

If True, the App's geometry (size + position) is saved on close and restored on next launch, with off-screen positions clamped back into a visible monitor. Off by default so existing apps that pin a size/position keep doing so.

state_path str | None

Optional override for where window state is stored. When None, defaults to a per-app file under the OS config directory (Library/Application Support on macOS, %APPDATA% on Windows, $XDG_CONFIG_HOME on Linux). The leaf filename includes app_name so multiple bootstack apps don't collide.

Examples:

# Create app with default settings
app = App()

# Create app with custom settings
settings = AppSettings(
    app_name="My App",
    theme="dark",
    locale="de_DE"
)
app = App(settings=settings)

# Access settings
print(app.settings.locale)  # 'de_DE'
print(app.settings.date_format)  # 'd.M.yy'

__post_init__

__post_init__()

Populate localization defaults when not explicitly configured.