Windows

Contents

Summary

MainWindow

Container for static functions used to manipulate the main window.

Window

Creates a new window.

MenuBar

A menu bar that can be added to a Window.

Main Window

class dearpygui_obj.window.MainWindow(*args, **kwargs)[source]

Bases: object

Container for static functions used to manipulate the main window.

Attempting to instantiate this class will raise a TypeError.

Warning

The viewport only exists when the GUI engine is running (see dearpygui_obj.is_running()). Some of the methods contained in this class may fail if called when the engine is not running.

static set_title(title: str) None[source]
static set_pos(x: int, y: int) None[source]
static allow_resize(enabled: bool)[source]
static set_size(width: int, height: int)[source]
static get_size() Tuple[int, int][source]
static set_primary_window(window: Optional[Window]) None[source]

Set a window as the primary window, or remove the primary window.

When a window is set as the primary window it will fill the entire viewport.

If any other window was already set as the primary window, it will be unset.

static set_resize_callback(callback: Callable)[source]

Set a callback for when the main viewport is resized.

static enable_docking(**kwargs)[source]

Enable docking and set docking options.

Note

Once docking is enabled, it cannot be disabled.

Keyword Arguments
  • shift_only – if True, hold down shift for docking. If False, dock by dragging window titlebars.

  • dock_space – if True, windows will be able to dock with the main window viewport.

foreground = <dearpygui_obj.window.MainWindow._ForegroundCanvas object>

A special DrawingCanvas that can be used to draw on the foreground of the viewport.

background = <dearpygui_obj.window.MainWindow._BackgroundCanvas object>

A special DrawingCanvas that can be used to draw on the background of the viewport.

Window

class dearpygui_obj.window.Window(label: Optional[str] = None, **config)[source]

Bases: dearpygui_obj.wrapper.widget.Widget, dearpygui_obj.wrapper.widget.ContainerWidgetMx[Window]

Creates a new window.

label: str

Read or modify the ‘label’ config property.

x_pos: int

Read or modify the ‘x_pos’ config property.

y_pos: int

Read or modify the ‘y_pos’ config property.

autosize: bool

Read or modify the ‘autosize’ config property.

no_resize: bool

Read or modify the ‘no_resize’ config property.

no_title_bar: bool

Read or modify the ‘no_title_bar’ config property.

no_move: bool

Read or modify the ‘no_move’ config property.

no_collapse: bool

Read or modify the ‘no_collapse’ config property.

no_focus_on_appearing: bool

Read or modify the ‘no_focus_on_appearing’ config property.

no_bring_to_front_on_focus: bool

Read or modify the ‘no_bring_to_front_on_focus’ config property.

no_close: bool

Read or modify the ‘no_close’ config property.

no_background: bool

Read or modify the ‘no_background’ config property.

show_menubar: bool

Read or modify the ‘menubar’ config property.

no_scrollbar: bool

Disable scrollbars (can still scroll with mouse or programmatically).

horizontal_scrollbar: bool

Allow horizontal scrollbar to appear.

pos: Tuple[int, int]

Get or set (x_pos, y_pos) as a tuple.

on_close(callback: Optional[PyGuiCallback]) Callable[source]

Set on_close callback, can be used as a decorator.

resized(callback: PyGuiCallback) Callable[source]

Set resized callback, can be used as a decorator.

get_canvas() dearpygui_obj.drawing.WindowCanvas[source]

Obtain a WindowCanvas that can be used to draw on the window using the drawing API.

class dearpygui_obj.window.MenuBar(**config)[source]

Bases: dearpygui_obj.wrapper.widget.Widget, dearpygui_obj.wrapper.widget.ItemWidgetMx, dearpygui_obj.wrapper.widget.ContainerWidgetMx[MenuBar]

A menu bar that can be added to a Window.