Skip to content

Toplevel

Bases: BaseWindow, WidgetCapabilitiesMixin, Toplevel

A themed top-level window.

This class wraps tkinter.Toplevel and adds bootstack window conveniences (title/geometry helpers, centering, alpha/topmost/toolwindow helpers, etc.).

The standard widget API (events, scheduling, clipboard, geometry managers, winfo, etc.) is available through inheritance and is documented under bootstack capabilities.

For additional information on the underlying Tk/Tkinter behavior, see: - Tcl/Tk toplevel command documentation - Python tkinter.Toplevel documentation

Examples:

>>> win = Toplevel(title="My Toplevel")
>>> win.mainloop()

__init__

__init__(
    title: str = "bootstack",
    icon: PhotoImage | None = None,
    size: Optional[Tuple[int, int]] = None,
    position: Optional[Tuple[int, int]] = None,
    minsize: Optional[Tuple[int, int]] = None,
    maxsize: Optional[Tuple[int, int]] = None,
    resizable: Optional[Tuple[bool, bool]] = None,
    transient: Optional[Misc] = None,
    overrideredirect: bool = False,
    windowtype: Optional[str] = None,
    topmost: bool = False,
    toolwindow: bool = False,
    alpha: float = 1.0,
    window_style: Optional[str] = None,
    **kwargs: Any,
) -> None

Initialize a top-level window.

Parameters:

Name Type Description Default
title str

The title that appears on the window titlebar.

'bootstack'
icon PhotoImage | None

A PhotoImage used for the titlebar icon. If None, the default bootstack icon is used.

None
size Optional[Tuple[int, int]]

Window size as (width, height). Applied via geometry.

None
position Optional[Tuple[int, int]]

Window position as (x, y). Applied via geometry.

None
minsize Optional[Tuple[int, int]]

Minimum permissible window size as (width, height).

None
maxsize Optional[Tuple[int, int]]

Maximum permissible window size as (width, height).

None
resizable Optional[Tuple[bool, bool]]

Whether the user may resize the window as (x, y).

None
transient Optional[Misc]

Mark this window as transient for the given master.

None
overrideredirect bool

If True, instruct the window manager to ignore this window.

False
windowtype Optional[str]

On X11, request a specific window manager type via -type.

None
topmost bool

If True, keep this window above others (-topmost).

False
toolwindow bool

On Windows, request a toolwindow style (-toolwindow).

False
alpha float

On Windows, the window alpha transparency (0.0–1.0) via -alpha.

1.0
window_style Optional[str]

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

None
**kwargs Any

Other keyword arguments passed to tkinter.Toplevel.

{}