Skip to main content

FletApp

Renders another Flet app in the current app, similar to HTML IFrame, but for Flet.

Inherits: LayoutControl

Properties

Events

  • on_error - Called when a connection or any unhandled error occurs.
  • on_python_output - Fires once per stdout/stderr write inside the embedded Pyodide app.

Properties

app_error_messageclass-attributeinstance-attribute

app_error_message: str | None = None

Template message to display when the app fails to load. Use {message} placeholder to include the error message and {details} to include error details.

app_startup_screen_messageclass-attributeinstance-attribute

app_startup_screen_message: str | None = None

Message to display on the app startup screen.

Deprecated: use boot_screen_options instead, e.g. boot_screen_options={"startup_message": "Loading…"}.

argsclass-attributeinstance-attribute

args: dict[str, Any] | None = None

Optional dictionary of arguments to pass to the Flet app.

assets_dirclass-attributeinstance-attribute

assets_dir: str | None = None

Base location for assets referenced by the embedded app. On web this is a URL prefix joined with relative src values (e.g. on Image/Lottie/Markdown); on desktop it is a filesystem path.

boot_screen_nameclass-attributeinstance-attribute

boot_screen_name: str | None = None

Name of the boot screen to show while the embedded app starts up.

When None, the built-in "flet" boot screen is used. Custom boot screens are provided by extensions; see the boot screen docs.

boot_screen_optionsclass-attributeinstance-attribute

boot_screen_options: dict[str, Any] | None = None

Options for the boot screen, passed through to the boot screen widget.

For the built-in "flet" screen these include spinner_size, startup_message, bgcolor_light/bgcolor_dark, etc. See the boot screen docs.

force_pyodideclass-attributeinstance-attribute

force_pyodide: bool = False

Whether to force the use of Pyodide.

reconnect_interval_msclass-attributeinstance-attribute

reconnect_interval_ms: int | None = None

Delay, in milliseconds, between reconnection attempts.

reconnect_timeout_msclass-attributeinstance-attribute

reconnect_timeout_ms: int | None = None

Total time to try reconnecting.

show_app_startup_screenclass-attributeinstance-attribute

show_app_startup_screen: bool = False

Whether to show the app startup screen.

Deprecated: use boot_screen_options instead, e.g. boot_screen_options={"spinner_size": 30}.

urlclass-attributeinstance-attribute

url: str | None = None

Flet app URL, e.g. http://localhost:8550 or flet.sock.

Events

on_errorclass-attributeinstance-attribute

on_error: ControlEventHandler[FletApp] | None = None

Called when a connection or any unhandled error occurs.

on_python_outputclass-attributeinstance-attribute

on_python_output: (
    EventHandler[FletAppOutputEvent] | None
) = None

Fires once per stdout/stderr write inside the embedded Pyodide app. Pyodide line-buffers by default, so each event is typically one print(...) call. Only fires for embedded FletApps with force_pyodide=True; root-level Pyodide pages have nowhere to bubble the event.