edifice.WindowPopView#

class edifice.WindowPopView(title='', icon=None, on_close=None, on_window_state_change=None, full_screen=False, _size_open=None, **kwargs)[source]#

Bases: VBoxView

Pop-up Window.

This Element will render as a new operating system window instead of appearing in its parent’s layout. It will occupy a zero-size position in its parent’s layout.

Pop-up Window Example#
@component
def Main(self):

    popshow, popshow_set = use_state(False)

    with Window(
        title="Main Window",
    ):
        CheckBox(
            checked=popshow,
            text="Show Pop-up Window",
            on_change=popshow_set,
        )
        if popshow:
            with WindowPopView(
                title="Pop-up Window",
                on_close=lambda _: popshow_set(False),
            ):
                Label(
                    text="This is a Pop-up Window",
                )
Parameters:
  • title (str) – The window title.

  • icon (Union[str, QImage, QPixmap, None]) –

    The window icon image.

    See caveats in windowIcon. This prop is not supported on all platforms.

  • on_close (Optional[Callable[[QCloseEvent], Optional[Awaitable[None]]]]) –

    When the user tries to close this window, the window will not close. Instead, this event handler will be called.

    The only way to close a WindowPopView is to remove it from its parent’s layout. This event handler should set some state which causes the WindowPopView to be removed from the parent layout. See the example above.

    The event handler function will be passed a QCloseEvent.

  • on_window_state_change (Optional[Callable[[Literal['Normal', 'Maximized', 'Minimized', 'FullScreen'], Literal['Normal', 'Maximized', 'Minimized', 'FullScreen']], Optional[Awaitable[None]]]]) –

    Event handler for when the window state changes.

    This event handler will be passed the old window state and the new window state.

  • full_screen (bool) – Whether the window is in full screen mode.

  • _size_open (Union[tuple[int, int], Literal['Maximized'], None]) –

    This argument is not a prop and will not cause re-render when changed.

    It will only be used once to set width and height of the window when it is opened.

    If the value "Maximized" is passed, the window will be opened maximized (does not work on X11, see showMaximized ).

Methods

__init__([title, icon, on_close, ...])

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying_noparent

Special widget that is not a child of any parent widget.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.

underlying_noparent: QtWidgets.QWidget | None#

Special widget that is not a child of any parent widget. The layout of this Element is set to this widget, and all Element children are children of this widget.