Skip to content

pywry.window_proxy

Full OS window control proxy returned by app.show().

Includes window lifecycle, geometry, appearance, webview, cookie, and menu management methods. See the Window Management guide and Native Menus guide for usage patterns.


pywry.window_proxy.WindowProxy

WindowProxy(label: str)

Proxy for pytauri.webview.WebviewWindow with full API access.

Provides transparent IPC to the subprocess, exposing all WebviewWindow methods as either blocking (for property getters) or fire-and-forget (for actions and setters).

PARAMETER DESCRIPTION
label

The window label to control.

TYPE: str

Examples:

>>> proxy = WindowProxy("main")
>>> proxy.set_title("My App")
>>> proxy.maximize()
>>> print(proxy.is_maximized)  # True
>>> proxy.set_background_color((30, 30, 30, 255))

Initialize the window proxy.

PARAMETER DESCRIPTION
label

The window label to control.

TYPE: str

Attributes

_label instance-attribute

_label = label

label property

label: str

Get window label.

title property

title: str

Get window title.

url property

url: str

Get current URL.

theme property

theme: Theme

Get current theme.

scale_factor property

scale_factor: float

Get display scale factor.

inner_position property

inner_position: PhysicalPosition

Get inner position.

outer_position property

outer_position: PhysicalPosition

Get outer position.

inner_size property

inner_size: PhysicalSize

Get inner dimensions.

outer_size property

outer_size: PhysicalSize

Get outer dimensions.

cursor_position property

cursor_position: PhysicalPosition

Get cursor position relative to window.

current_monitor property

current_monitor: Monitor | None

Get current monitor.

primary_monitor property

primary_monitor: Monitor | None

Get primary monitor.

available_monitors property

available_monitors: list[Monitor]

Get all available monitors.

is_fullscreen property

is_fullscreen: bool

Check if window is fullscreen.

is_minimized property

is_minimized: bool

Check if window is minimized.

is_maximized property

is_maximized: bool

Check if window is maximized.

is_focused property

is_focused: bool

Check if window is focused.

is_decorated property

is_decorated: bool

Check if window has decorations.

is_resizable property

is_resizable: bool

Check if window is resizable.

is_enabled property

is_enabled: bool

Check if window is enabled.

is_visible property

is_visible: bool

Check if window is visible.

is_closable property

is_closable: bool

Check if window is closable.

is_maximizable property

is_maximizable: bool

Check if window is maximizable.

is_minimizable property

is_minimizable: bool

Check if window is minimizable.

is_always_on_top property

is_always_on_top: bool

Check if window is always on top.

is_always_on_bottom property

is_always_on_bottom: bool

Check if window is always on bottom.

is_devtools_open property

is_devtools_open: bool

Check if DevTools is open.

Functions

show

show() -> None

Show the window.

hide

hide() -> None

Hide the window.

close

close() -> None

Close the window.

destroy

destroy() -> None

Destroy the window.

maximize

maximize() -> None

Maximize the window.

unmaximize

unmaximize() -> None

Restore from maximized.

minimize

minimize() -> None

Minimize the window.

unminimize

unminimize() -> None

Restore from minimized.

toggle_maximize

toggle_maximize() -> None

Toggle between maximized and restored.

center

center() -> None

Center window on screen.

set_focus

set_focus() -> None

Set focus to window.

reload

reload() -> None

Reload the webview.

print_page

print_page() -> None

Print the page.

open_devtools

open_devtools() -> None

Open DevTools.

close_devtools

close_devtools() -> None

Close DevTools.

clear_all_browsing_data

clear_all_browsing_data() -> None

Clear all browsing data.

start_dragging

start_dragging() -> None

Start window dragging.

request_user_attention

request_user_attention(attention_type: UserAttentionType | None = None) -> None

Request user attention (flash/bounce).

set_title

set_title(title: str) -> None

Set window title.

set_size

set_size(size: SizeType) -> None

Set window size.

set_min_size

set_min_size(size: SizeType | None) -> None

Set minimum window size.

set_max_size

set_max_size(size: SizeType | None) -> None

Set maximum window size.

set_position

set_position(position: PositionType) -> None

Set window position.

set_fullscreen

set_fullscreen(fullscreen: bool) -> None

Toggle fullscreen mode.

set_decorations

set_decorations(decorations: bool) -> None

Toggle window decorations.

set_always_on_top

set_always_on_top(always_on_top: bool) -> None

Toggle always-on-top.

set_always_on_bottom

set_always_on_bottom(always_on_bottom: bool) -> None

Toggle always-on-bottom.

set_resizable

set_resizable(resizable: bool) -> None

Toggle resizable.

set_enabled

set_enabled(enabled: bool) -> None

Toggle enabled.

set_closable

set_closable(closable: bool) -> None

Toggle closable.

set_maximizable

set_maximizable(maximizable: bool) -> None

Toggle maximizable.

set_minimizable

set_minimizable(minimizable: bool) -> None

Toggle minimizable.

set_visible_on_all_workspaces

set_visible_on_all_workspaces(visible: bool) -> None

Toggle visibility on all workspaces.

set_skip_taskbar

set_skip_taskbar(skip: bool) -> None

Toggle skip taskbar.

set_cursor_icon

set_cursor_icon(icon: CursorIcon) -> None

Set cursor icon.

set_cursor_position

set_cursor_position(position: PositionType) -> None

Set cursor position.

set_cursor_visible

set_cursor_visible(visible: bool) -> None

Toggle cursor visibility.

set_cursor_grab

set_cursor_grab(grab: bool) -> None

Toggle cursor grab.

set_ignore_cursor_events

set_ignore_cursor_events(ignore: bool) -> None

Toggle ignoring cursor events (click-through).

set_icon

set_icon(icon: bytes | None) -> None

Set window icon (PNG bytes or None).

set_shadow

set_shadow(enable: bool) -> None

Toggle window shadow.

set_title_bar_style

set_title_bar_style(style: TitleBarStyle) -> None

Set title bar style.

set_theme

set_theme(theme: Theme | None) -> None

Set window theme.

set_content_protected

set_content_protected(protected: bool) -> None

Prevent window contents from being captured by screenshots.

set_traffic_light_position

set_traffic_light_position(x: float, y: float) -> None

Set macOS traffic light button position.

set_size_constraints

set_size_constraints(min_size: SizeType | None = None, max_size: SizeType | None = None) -> None

Set both min and max size constraints in a single call.

monitor_from_point

monitor_from_point(x: float, y: float) -> Monitor | None

Get the monitor that contains the given point.

eval

eval(script: str) -> None

Execute JavaScript in the webview (fire-and-forget).

eval_with_result

eval_with_result(script: str, timeout: float = 5.0) -> Any

Execute JavaScript and return the result (blocking).

Note: Result serialization depends on the JS return value.

navigate

navigate(url: str) -> None

Navigate to URL.

set_zoom

set_zoom(scale: float) -> None

Set zoom level.

set_background_color

set_background_color(color: Color) -> None

Set background color (r, g, b, a).

set_effects

set_effects(effects: Effects) -> None

Set visual effects (Mica, Blur, Acrylic, etc.).

set_progress_bar

set_progress_bar(state: ProgressBarState) -> None

Set progress bar state.

set_badge_count

set_badge_count(count: int | None) -> None

Set badge count (dock/taskbar).

set_overlay_icon

set_overlay_icon(icon: bytes | None) -> None

Set overlay icon (Windows taskbar).

cookies

cookies() -> list[Cookie]

Get all cookies.

set_cookie(cookie: Cookie) -> None

Set a cookie.

delete_cookie(name: str) -> None

Delete a cookie by name.

set_menu

set_menu(menu: Any) -> None

Attach a menu to this window.

PARAMETER DESCRIPTION
menu

The menu proxy to attach.

TYPE: MenuProxy

remove_menu

remove_menu() -> None

Remove the menu bar from this window.

hide_menu

hide_menu() -> None

Hide the menu bar (without removing it).

show_menu

show_menu() -> None

Show a previously hidden menu bar.

is_menu_visible

is_menu_visible() -> bool

Check whether the menu bar is visible.

popup_menu

popup_menu(menu: Any, x: float | None = None, y: float | None = None) -> None

Show a context (popup) menu at the given position.

PARAMETER DESCRIPTION
menu

The menu to show.

TYPE: MenuProxy

x

X coordinate in logical pixels (None = cursor position).

TYPE: float or None DEFAULT: None

y

Y coordinate in logical pixels (None = cursor position).

TYPE: float or None DEFAULT: None

__repr__

__repr__() -> str

Return string representation.