Skip to content

pytauri.ffi

Original FFI interface module.

Warning

All APIs under this module should not be considered stable. You should use the re-exported APIs under the top-level module.

Modules:

Name Description
image
ipc
lib
menu
path
tray
webview
window

Classes:

Name Description
App
AppHandle
Assets
Builder
BuilderArgs
Context
Emitter
Event
EventTarget
Listener
Manager
Position
Rect
RunEvent
Size

Functions:

Name Description
builder_factory

A factory function for creating a Builder instance.

context_factory

A factory function for creating a Context instance.

Attributes:

Name Type Description
EXT_MOD ModuleType

The extension module of pytauri app.

EventId
EventTargetType

See EventTarget for details.

ImplEmitter
ImplListener
ImplManager
PositionType

See Position for details.

RunEventType

See RunEvent for details.

SizeType

See Size for details.

Url

EXT_MOD module-attribute

EXT_MOD: ModuleType

The extension module of pytauri app.

It will be loaded from entry_points(group="pytauri", name="ext_mod").

Usually you don't need to use it, unless you want to write plugins for pytauri.

EventId module-attribute

EventId = NewType('EventId', int)

EventTargetType module-attribute

EventTargetType = TypeAliasType('EventTargetType', Union[Any, AnyLabel, App, Window, Webview, WebviewWindow])

See EventTarget for details.

ImplEmitter module-attribute

ImplEmitter = ImplManager

ImplListener module-attribute

ImplListener = ImplManager

ImplManager module-attribute

ImplManager = TypeAliasType('ImplManager', Union[App, AppHandle, 'WebviewWindow'])

PositionType module-attribute

PositionType = TypeAliasType('PositionType', Union[Physical, Logical])

See Position for details.

RunEventType module-attribute

See RunEvent for details.

SizeType module-attribute

SizeType = TypeAliasType('SizeType', Union[Physical, Logical])

See Size for details.

Url module-attribute

Url = TypeAliasType('Url', str)

__all__ module-attribute

__all__ = ('EXT_MOD', 'App', 'AppHandle', 'Assets', 'Builder', 'BuilderArgs', 'Context', 'Emitter', 'Event', 'EventId', 'EventTarget', 'EventTargetType', 'ImplEmitter', 'ImplListener', 'ImplManager', 'Listener', 'Manager', 'Position', 'PositionType', 'Rect', 'RunEvent', 'RunEventType', 'Size', 'SizeType', 'Url', 'builder_factory', 'context_factory')

App

Tauri::app

Warning

This class is not thread-safe, and should not be shared between threads.

  • You can only use it on the thread it was created on.
  • And you need to ensure it is garbage collected on the thread it was created on, otherwise it will cause memory leaks.

Methods:

Name Description
run

Consume and run this app, will block until the app is exited.

run_return

Consume and run this application, returning its intended exit code.

run_iteration

Run this app iteratively without consuming it, calling callback on each iteration.

cleanup_before_exit

Runs necessary cleanup tasks before exiting the process.

handle

Get a handle to this app, which can be used to interact with the app from another thread.

run

run(callback: Optional[_AppRunCallbackType] = None) -> NoReturn

Consume and run this app, will block until the app is exited.

Parameters:

Name Type Description Default

callback

Optional[_AppRunCallbackType]

a callback function that will be called on each event. It will be called on the same thread that the app was created on, so you should not block in this function.

None

Note

This function will call std::process::exit at the end to terminate the entire process, which means the Python interpreter cannot be properly finalized. If this is a problem for you, please use pytauri.App.run_return.

Warning

If callback is specified, it must not raise an exception, otherwise it is logical undefined behavior, and in most cases, the program will panic.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def run(self, callback: Optional[_AppRunCallbackType] = None, /) -> NoReturn:
    """Consume and run this app, will block until the app is exited.

    Args:
        callback: a callback function that will be called on each event.
            It will be called on the same thread that the app was created on,
            so you should not block in this function.

    !!! note
        This function will call `std::process::exit` at the end to terminate the entire process,
        which means the Python interpreter cannot be properly finalized.
        If this is a problem for you, please use [pytauri.App.run_return][].

    !!! warning
        If `callback` is specified, it must not raise an exception,
        otherwise it is logical undefined behavior, and in most cases, the program will panic.
    """
    ...

run_return

run_return(callback: Optional[_AppRunCallbackType] = None) -> int

Consume and run this application, returning its intended exit code.

Warning

callback has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def run_return(self, callback: Optional[_AppRunCallbackType] = None, /) -> int:
    """Consume and run this application, returning its intended exit code.

    !!! warning
        `callback` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

run_iteration deprecated

run_iteration(callback: Optional[_AppRunCallbackType] = None) -> None
Deprecated

When called in a loop (as suggested by the name), this function will busy-loop. To re-gain control of control flow after the app has exited, use App::run_return instead. See https://docs.rs/tauri/latest/tauri/struct.App.html#method.run_iteration for more details.

Run this app iteratively without consuming it, calling callback on each iteration.

Parameters:

Name Type Description Default

callback

Optional[_AppRunCallbackType]

a callback function that will be called on each iteration.

None

Warning

callback has the same restrictions as App.run.

Tip

Approximately 2ms per calling in debug mode.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@deprecated(
    """When called in a loop (as suggested by the name), this function will busy-loop.
    To re-gain control of control flow after the app has exited, use `App::run_return` instead.
    See <https://docs.rs/tauri/latest/tauri/struct.App.html#method.run_iteration> for more details.""",
    category=None,
)
def run_iteration(
    self, callback: Optional[_AppRunCallbackType] = None, /
) -> None:
    """Run this app iteratively without consuming it, calling `callback` on each iteration.

    Args:
        callback: a callback function that will be called on each iteration.

    !!! warning
        `callback` has the same restrictions as [App.run][pytauri.App.run].

    !!! tip
        Approximately 2ms per calling in debug mode.
    """

cleanup_before_exit

cleanup_before_exit() -> None

Runs necessary cleanup tasks before exiting the process.

You should always exit the tauri app immediately after this function returns and not use any tauri-related APIs.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def cleanup_before_exit(self, /) -> None:
    """Runs necessary cleanup tasks before exiting the process.

    **You should always exit the tauri app immediately after this function returns and not use any tauri-related APIs.**
    """

handle

handle() -> AppHandle

Get a handle to this app, which can be used to interact with the app from another thread.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def handle(self, /) -> "AppHandle":
    """Get a handle to this app, which can be used to interact with the app from another thread."""
    ...

AppHandle

tauri::AppHandle

Methods:

Name Description
run_on_main_thread

Runs the given closure on the main thread.

exit
restart
on_menu_event

Registers a global menu event listener.

on_tray_icon_event

Registers a global tray icon menu event listener.

tray_by_id
remove_tray_by_id
default_window_icon

Returns the default window icon.

menu
set_menu
remove_menu
hide_menu
show_menu
invoke_key

run_on_main_thread

run_on_main_thread(handler: Callable[[], object]) -> None

Runs the given closure on the main thread.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def run_on_main_thread(self, handler: Callable[[], object], /) -> None:
    """Runs the given closure on the main thread.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

exit

exit(exit_code: int) -> None
Source code in python/pytauri/src/pytauri/ffi/lib.py
def exit(self, exit_code: int, /) -> None: ...

restart

restart() -> Never
Source code in python/pytauri/src/pytauri/ffi/lib.py
def restart(self, /) -> Never: ...

on_menu_event

on_menu_event(handler: Callable[[Self, MenuEvent], None]) -> None

Registers a global menu event listener.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def on_menu_event(
    self, handler: Callable[["Self", "MenuEvent"], None], /
) -> None:
    """Registers a global menu event listener.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """

on_tray_icon_event

on_tray_icon_event(handler: Callable[[Self, TrayIconEventType], None]) -> None

Registers a global tray icon menu event listener.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def on_tray_icon_event(
    self, handler: Callable[[Self, TrayIconEventType], None], /
) -> None:
    """Registers a global tray icon menu event listener.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """

tray_by_id

tray_by_id(id: str) -> Optional[TrayIcon]
Source code in python/pytauri/src/pytauri/ffi/lib.py
def tray_by_id(self, id: str, /) -> Optional[TrayIcon]: ...  # noqa: A002

remove_tray_by_id

remove_tray_by_id(id: str) -> Optional[TrayIcon]
Source code in python/pytauri/src/pytauri/ffi/lib.py
def remove_tray_by_id(self, id: str, /) -> Optional[TrayIcon]: ...  # noqa: A002

default_window_icon

default_window_icon() -> Optional[Image]

Returns the default window icon.

Warning

Each time you call this function, a new image instance will be created. So you should cache the result if you need to use it multiple times.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def default_window_icon(self, /) -> Optional[Image]:
    """Returns the default window icon.

    !!! warning
        Each time you call this function, a new image instance will be created.
        So you should cache the result if you need to use it multiple times.
    """

menu

menu() -> Optional[Menu]
Source code in python/pytauri/src/pytauri/ffi/lib.py
def menu(self) -> Optional[Menu]: ...

set_menu

set_menu(menu: Menu) -> Optional[Menu]
Source code in python/pytauri/src/pytauri/ffi/lib.py
def set_menu(self, menu: Menu, /) -> Optional[Menu]: ...

remove_menu

remove_menu() -> Optional[Menu]
Source code in python/pytauri/src/pytauri/ffi/lib.py
def remove_menu(self) -> Optional[Menu]: ...

hide_menu

hide_menu() -> None
Source code in python/pytauri/src/pytauri/ffi/lib.py
def hide_menu(self) -> None: ...

show_menu

show_menu() -> None
Source code in python/pytauri/src/pytauri/ffi/lib.py
def show_menu(self) -> None: ...

invoke_key

invoke_key() -> str
Source code in python/pytauri/src/pytauri/ffi/lib.py
def invoke_key(self) -> str: ...

Assets

Bases: ABC

tauri::Assets

This is an abstract class that you can subclass to implement a custom asset loader.

See tauri::Assets rust docs for more details.

Warning

The implement has the same restrictions as App.run.

Methods:

Name Description
get
iter
setup

get abstractmethod

get(key: _AssetKey) -> Optional[bytes]
Source code in python/pytauri/src/pytauri/ffi/lib.py
@abstractmethod
def get(self, key: _AssetKey, /) -> Optional[bytes]: ...

iter abstractmethod

iter() -> Iterator[tuple[str, bytes]]
Source code in python/pytauri/src/pytauri/ffi/lib.py
@abstractmethod
def iter(self, /) -> Iterator[tuple[str, bytes]]: ...

setup

setup(_app: AppHandle) -> object
Source code in python/pytauri/src/pytauri/ffi/lib.py
def setup(self, _app: AppHandle, /) -> object:
    return None

Builder

Tauri::Builder

use builder_factory to instantiate this class.

Warning

This class is not thread-safe, and should not be shared between threads.

  • You can only use it on the thread it was created on.
  • And you need to ensure it is garbage collected on the thread it was created on, otherwise it will cause memory leaks.

Methods:

Name Description
build

Consume this builder and build an app with the given BuilderArgs.

build

build(args: BuilderArgs) -> App

Consume this builder and build an app with the given BuilderArgs.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def build(self, args: BuilderArgs, /) -> App:
    """Consume this builder and build an app with the given `BuilderArgs`."""
    ...

BuilderArgs

Methods:

Name Description
__new__

__new__

__new__(context: Context, *, invoke_handler: Optional[_InvokeHandlerProto], setup: Optional[Callable[[AppHandle], object]] = None) -> Self

tauri::Builder

Warning

The implementer of invoke_handler must never raise an exception, otherwise it is considered logical undefined behavior. Additionally, invoke_handler must not block.

Warning

If you do not specify invoke_handler, pytauri will not register the tauri-plugin-pytauri plugin, which means you cannot use pyInvoke in the frontend to call Commands (you will receive an error like "plugin pytauri not found"). If this is indeed the behavior you expect, explicitly pass None.

Parameters:

Name Type Description Default

context

Context

use context_factory to get it.

required

invoke_handler

Optional[_InvokeHandlerProto]

use Commands to get it.

required

setup

Optional[Callable[[AppHandle], object]]

see rust tauri::Builder::setup.

None
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(
    cls,
    /,
    context: "Context",
    *,
    invoke_handler: Optional[_InvokeHandlerProto],
    setup: Optional[Callable[[AppHandle], object]] = None,
) -> Self:
    """[tauri::Builder](https://docs.rs/tauri/latest/tauri/struct.Builder.html)

    !!! warning
        The implementer of [invoke_handler][pytauri.ffi.lib.BuilderArgs.__new__(invoke_handler)] must never raise an exception,
        otherwise it is considered logical undefined behavior.
        Additionally, `invoke_handler` must not block.

    !!! warning
        If you do not specify [invoke_handler][pytauri.ffi.lib.BuilderArgs.__new__(invoke_handler)],
        `pytauri` will not register the `tauri-plugin-pytauri` plugin,
        which means you cannot use `pyInvoke` in the frontend to call `Commands`
        (you will receive an error like ["plugin pytauri not found"]).
        If this is indeed the behavior you expect, explicitly pass [None][].

        ["plugin pytauri not found"]: https://github.com/pytauri/pytauri/issues/110

    Args:
        context: use [context_factory][pytauri.context_factory] to get it.
        invoke_handler: use [Commands][pytauri.ipc.Commands] to get it.
        setup: see rust `tauri::Builder::setup`.
    """
    ...

Context

tauri::Context

Methods:

Name Description
set_assets

Use custom assets instead of the assets bundled by Tauri.

set_assets

set_assets(assets: Assets) -> None

Use custom assets instead of the assets bundled by Tauri.

To make this work:

  • You need to enable the tauri/custom-protocol feature.
    • Or build using tauri build.
  • Set frontendDist in tauri.conf.json to an empty directory (do not set it to a URL).
    • Or generate Context via:

      use tauri::{generate_context, test::noop_assets};
      
      let context = generate_context!(assets=noop_assets());
      

      then we will use this method to set the assets.

      see: https://github.com/tauri-apps/tauri/pull/9141

Source code in python/pytauri/src/pytauri/ffi/lib.py
def set_assets(self, assets: "Assets", /) -> None:
    """Use custom assets instead of the assets bundled by Tauri.

    To make this work:

    - You need to enable the `tauri/custom-protocol` feature.
        - Or build using `tauri build`.
    - Set `frontendDist` in `tauri.conf.json` to an empty directory (do not set it to a URL).
        - Or generate `Context` via:

            ```rust
            use tauri::{generate_context, test::noop_assets};

            let context = generate_context!(assets=noop_assets());
            ```

            then we will use this method to set the assets.

            see: <https://github.com/tauri-apps/tauri/pull/9141>
    """

Emitter

tauri::Emitter

Methods:

Name Description
emit_str

Similar to [Emitter::emit] but the payload is json serialized.

emit_str_to

Similar to [Emitter::emit_to] but the payload is json serialized.

emit_str_filter

Similar to [Emitter::emit_filter] but the payload is json serialized.

emit_str staticmethod

emit_str(slf: ImplEmitter, event: str, payload: str) -> None

Similar to [Emitter::emit] but the payload is json serialized.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def emit_str(
    slf: "ImplEmitter",
    event: str,
    payload: str,
    /,
) -> None:
    """Similar to [`Emitter::emit`] but the payload is json serialized."""
    ...

emit_str_to staticmethod

emit_str_to(slf: ImplEmitter, target: EventTargetType, event: str, payload: str) -> None

Similar to [Emitter::emit_to] but the payload is json serialized.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def emit_str_to(
    slf: "ImplEmitter",
    target: "EventTargetType",
    event: str,
    payload: str,
    /,
) -> None:
    """Similar to [`Emitter::emit_to`] but the payload is json serialized."""
    ...

emit_str_filter staticmethod

emit_str_filter(slf: ImplEmitter, event: str, payload: str, filter: Callable[[EventTargetType], bool]) -> None

Similar to [Emitter::emit_filter] but the payload is json serialized.

Warning

filter has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def emit_str_filter(
    slf: "ImplEmitter",
    event: str,
    payload: str,
    filter: Callable[["EventTargetType"], bool],  # noqa: A002
    /,
) -> None:
    """Similar to [`Emitter::emit_filter`] but the payload is json serialized.

    !!! warning
        `filter` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

Event

tauri::Event

Attributes:

Name Type Description
id EventId

The EventId of the handler that was triggered.

payload str

The event payload.

id property

id: EventId

The EventId of the handler that was triggered.

payload property

payload: str

The event payload.

EventTarget

tauri::EventTarget

Classes:

Name Description
Any

Any and all event targets.

AnyLabel

Any Window, Webview or WebviewWindow that have this label.

App

App and AppHandle targets.

Window

Window target.

Webview

Webview target.

WebviewWindow

WebviewWindow target.

Any

Any and all event targets.

Methods:

Name Description
__new__

__new__

__new__() -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, /) -> Self: ...

AnyLabel

Any Window, Webview or WebviewWindow that have this label.

Methods:

Name Description
__new__

Attributes:

Name Type Description
label str

Target label.

label instance-attribute

label: str

Target label.

__new__

__new__(label: str) -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, label: str, /) -> Self: ...

App

App and AppHandle targets.

Methods:

Name Description
__new__

__new__

__new__() -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, /) -> Self: ...

Window

Window target.

Methods:

Name Description
__new__

Attributes:

Name Type Description
label str

window label.

label instance-attribute

label: str

window label.

__new__

__new__(label: str) -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, label: str, /) -> Self: ...

Webview

Webview target.

Methods:

Name Description
__new__

Attributes:

Name Type Description
label str

webview label.

label instance-attribute

label: str

webview label.

__new__

__new__(label: str) -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, label: str, /) -> Self: ...

WebviewWindow

WebviewWindow target.

Methods:

Name Description
__new__

Attributes:

Name Type Description
label str

webview window label.

label instance-attribute

label: str

webview window label.

__new__

__new__(label: str) -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(cls, label: str, /) -> Self: ...

Listener

tauri::Listener

See also: https://tauri.app/develop/calling-rust/#event-system

Examples

from pydantic import BaseModel
from pytauri import AppHandle, Event, Listener


class Payload(BaseModel):  # or `RootModel`
    url: str
    num: int


def listen(app_handle: AppHandle) -> None:
    def handler(event: Event):
        assert event.id == event_id

        serialized_event = Payload.model_validate_json(event.payload)
        print(serialized_event.url, serialized_event.num)

    event_id = Listener.listen(app_handle, "event_name", handler)

Methods:

Name Description
listen

Listen to an emitted event on this manager.

once

Listen to an event on this manager only once.

unlisten

Remove an event listener.

listen_any

Listen to an emitted event to any target.

once_any

Listens once to an emitted event to any target .

listen staticmethod

listen(slf: ImplListener, event: str, handler: _EventHandlerType) -> EventId

Listen to an emitted event on this manager.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def listen(
    slf: "ImplListener",
    event: str,
    handler: _EventHandlerType,
    /,
) -> "EventId":
    """Listen to an emitted event on this manager.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

once staticmethod

once(slf: ImplListener, event: str, handler: _EventHandlerType) -> EventId

Listen to an event on this manager only once.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def once(
    slf: "ImplListener",
    event: str,
    handler: _EventHandlerType,
    /,
) -> "EventId":
    """Listen to an event on this manager only once.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

unlisten staticmethod

unlisten(slf: ImplListener, id: EventId) -> None

Remove an event listener.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def unlisten(
    slf: "ImplListener",
    id: "EventId",  # noqa: A002
    /,
) -> None:
    """Remove an event listener."""
    ...

listen_any staticmethod

listen_any(slf: ImplListener, event: str, handler: _EventHandlerType) -> EventId

Listen to an emitted event to any target.

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def listen_any(
    slf: "ImplListener",
    event: str,
    handler: _EventHandlerType,
    /,
) -> "EventId":
    """Listen to an emitted event to any target.

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

once_any staticmethod

once_any(slf: ImplListener, event: str, handler: _EventHandlerType) -> EventId

Listens once to an emitted event to any target .

Warning

handler has the same restrictions as App.run.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def once_any(
    slf: "ImplListener",
    event: str,
    handler: _EventHandlerType,
    /,
) -> "EventId":
    """Listens once to an emitted event to any target .

    !!! warning
        `handler` has the same restrictions as [App.run][pytauri.App.run].
    """
    ...

Manager

tauri::Manager

Methods:

Name Description
app_handle

The application handle associated with this manager.

get_webview_window

Fetch a single webview window from the manager.

webview_windows

Fetch all managed webview windows.

path

The path resolver is a helper class for general and application-specific path APIs.

app_handle staticmethod

app_handle(slf: ImplManager) -> AppHandle

The application handle associated with this manager.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def app_handle(slf: "ImplManager", /) -> AppHandle:
    """The application handle associated with this manager."""
    ...

get_webview_window staticmethod

get_webview_window(slf: ImplManager, label: str) -> Optional[WebviewWindow]

Fetch a single webview window from the manager.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def get_webview_window(
    slf: "ImplManager", label: str, /
) -> Optional[WebviewWindow]:
    """Fetch a single webview window from the manager."""
    ...

webview_windows staticmethod

webview_windows(slf: ImplManager) -> dict[str, WebviewWindow]

Fetch all managed webview windows.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def webview_windows(slf: "ImplManager", /) -> dict[str, WebviewWindow]:
    """Fetch all managed webview windows."""
    ...

path staticmethod

path(slf: ImplManager) -> PathResolver

The path resolver is a helper class for general and application-specific path APIs.

Source code in python/pytauri/src/pytauri/ffi/lib.py
@staticmethod
def path(slf: "ImplManager", /) -> PathResolver:
    """The path resolver is a helper class for general and application-specific path APIs."""
    ...

Position

tauri::Position

Classes:

Name Description
Physical
Logical

Physical

Bases: NamedTuple

tauri::Position::Physical

[x, y]

Warning

This is actually a Class disguised as an NamedTuple. See also: https://pyo3.rs/v0.23.4/class.html#pyclass-enums.

Rect

tauri::Rect

Methods:

Name Description
__new__

Attributes:

Name Type Description
position PositionType
size SizeType

position property

position: PositionType

size property

size: SizeType

__new__

__new__(*, position: PositionType, size: SizeType) -> Self
Source code in python/pytauri/src/pytauri/ffi/lib.py
def __new__(
    cls,
    /,
    *,
    position: "PositionType",
    size: "SizeType",
) -> Self: ...

Size

builder_factory

builder_factory(*args: Any, **kwargs: Any) -> Builder

A factory function for creating a Builder instance.

This is the closure passed from the Rust side when initializing the pytauri pyo3 module. args and kwargs will be passed to this closure.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def builder_factory(*args: Any, **kwargs: Any) -> Builder:
    """A factory function for creating a `Builder` instance.

    This is the closure passed from the Rust side when initializing the pytauri pyo3 module.
    `args` and `kwargs` will be passed to this closure.
    """
    ...

context_factory

context_factory(*args: Any, **kwargs: Any) -> Context

A factory function for creating a Context instance.

This is the closure passed from the Rust side when initializing the pytauri pyo3 module. args and kwargs will be passed to this closure.

Source code in python/pytauri/src/pytauri/ffi/lib.py
def context_factory(*args: Any, **kwargs: Any) -> Context:
    """A factory function for creating a `Context` instance.

    This is the closure passed from the Rust side when initializing the pytauri pyo3 module.
    `args` and `kwargs` will be passed to this closure.
    """
    ...