slimgui - Python bindings for Dear ImGui

Overview

The Slimgui package provides modern Python bindings for the following libraries:

Slimgui has been developed with the following goals in mind:

The project source code is hosted on github.com/nurpax/slimgui.

The project has been developed using the Python glfw and pyOpenGL packages and includes integration backend for these APIs. It should be possible to develop integrations for other backends, such as SDL or Pygame.

Slimgui is built against Dear ImGui version 1.91.9.

Getting started

Slimgui requires Python 3.10 or newer.

Installation: pip install slimgui

To run the example, clone the repo, install dependencies and run:

git clone https://github.com/nurpax/slimgui
cd slimgui
pip install glfw pyopengl numpy requests
python example/app.py

Browse the example code: example/

Binding considerations

The Slimgui API is similar to pyimgui except somewhat modernized:

Dear ImGui Enums

A detailed enum and class reference can be found here: Enum Reference

Dear ImGui API functions

The following documentation is primarily adapted from Dear ImGui main header imgui.h, with minor modifications to adapt symbol naming to Pythonic snake case.

Context creation and access

Each context creates its own FontAtlas by default. You may instance one yourself and pass it to create_context() to share a font atlas between contexts.

Functions

def create_context(shared_font_atlas: FontAtlas | None = None) -> Context
def destroy_context(arg: Context, /) -> None

NULL = destroy current context

def get_current_context() -> Context
def set_current_context(arg: Context, /) -> None

Main

Functions

def get_style() -> Style

Access the Style structure (colors, sizes). Always use push_style_color(), push_style_var() to modify style mid-frame!

def new_frame() -> None

Start a new Dear ImGui frame, you can submit any command from this point until render()/end_frame().

def end_frame() -> None

Ends the Dear ImGui frame. automatically called by render(). If you don't need to render data (skipping rendering) you may call end_frame() without render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call new_frame() at all!

def render() -> None

Ends the Dear ImGui frame, finalize the draw data. You can then get call get_draw_data().

def get_draw_data() -> DrawData

Valid after render() and until the next call to new_frame(). this is what you have to render.

Demo, Debug, Information

Functions

def show_demo_window(closable: bool = False) -> bool

Create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!

def show_metrics_window(closable: bool = False) -> bool

Create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.

def show_debug_log_window(closable: bool = False) -> bool

Create Debug Log window. display a simplified log of important dear imgui events.

def show_id_stack_tool_window(closable: bool = False) -> bool

Create Stack Tool window. hover items with mouse to query information about the source of their unique ID.

def show_about_window(closable: bool = False) -> bool

Create About window. display Dear ImGui version, credits and build/system information.

def show_style_editor() -> None

Add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)

def show_style_selector(label: str) -> bool

Add style selector block (not a window), essentially a combo listing the default styles.

def show_font_selector(label: str) -> None

Add font selector block (not a window), essentially a combo listing the loaded fonts.

def show_user_guide() -> None

Add basic help/info block (not a window): how to manipulate ImGui as an end-user (mouse/keyboard controls).

def get_version() -> str

Get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)

Styles

Note: functions shown below intentionally do not accept None as the destination style. Python wrappers with same name exist in the slimgui module that can be called with None that then modifies the current context’s style.

Functions

def style_colors_dark(dst: Style) -> None

New, recommended style (default)

def style_colors_light(dst: Style) -> None

Best used with borders and a custom, thicker font

def style_colors_classic(dst: Style) -> None

Classic imgui style

Windows

Functions

def begin(name: str, closable: bool = False, flags: WindowFlags = WindowFlags.NONE) -> tuple[bool, bool]

When the closable argument is set to True, the created window will display a close button. The second bool of the return value will be False if the close button was pressed. The intended usage is as follows:

win_open = True  # open/closed state

visible, tab_open = imgui.begin(..., closable=win_open)
if visible:
    # render window contents here..
imgui.end()
def end() -> None

Every begin() call must be paired with a corresponding end() call, regardless of the return value of begin() return value.

Child Windows

Important: due to legacy reason, begin()/end() and begin_child()/end_child() are inconsistent with all other functions such as begin_menu()/end_menu(), begin_popup()/end_popup(), etc. where the end_xxx() call should only be called if the corresponding begin_xxx() function returned true. begin() and begin_child() are the only odd ones out. Will be fixed in a future update.

Functions

def begin_child(str_id: str, size: tuple[float, float] = (0.0, 0.0), child_flags: ChildFlags = ChildFlags.NONE, window_flags: WindowFlags = WindowFlags.NONE) -> bool
def end_child() -> None

Window Utilities

Functions

def is_window_appearing() -> bool
def is_window_collapsed() -> bool
def is_window_focused(flags: FocusedFlags = FocusedFlags.NONE) -> bool

Is current window focused? or its root/child, depending on flags. see flags for options.

def is_window_hovered(flags: HoveredFlags = HoveredFlags.NONE) -> bool

Is current window hovered and hoverable (e.g. not blocked by a popup/modal)? See HoveredFlags for options. IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app, you should not use this function! Use the 'io.WantCaptureMouse' boolean for that! Refer to FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" for details.

def get_window_pos() -> tuple[float, float]

Get current window position in screen space (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using get_cursor_screen_pos() and get_content_region_avail() instead)

def get_window_size() -> tuple[float, float]

Get current window size (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using get_cursor_screen_pos() and get_content_region_avail() instead)

def get_window_width() -> float

Get current window width (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for get_window_size().x.

def get_window_height() -> float

Get current window height (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for get_window_size().y.

Window Manipulation

Functions

def set_next_window_pos(pos: tuple[float, float], cond: Cond = Cond.NONE, pivot: tuple[float, float] = (0.0, 0.0)) -> None

Set next window position. call before begin(). use pivot=(0.5f,0.5f) to center on given point, etc.

def set_next_window_size(size: tuple[float, float], cond: Cond = Cond.NONE) -> None

Set next window size. set axis to 0.0f to force an auto-fit on this axis. call before begin()

def set_next_window_content_size(size: tuple[float, float]) -> None

Set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before begin()

def set_next_window_collapsed(collapsed: bool, cond: Cond = Cond.NONE) -> None

Set next window collapsed state. call before begin()

def set_next_window_focus() -> None

Set next window to be focused / top-most. call before begin()

def set_next_window_scroll(scroll: tuple[float, float]) -> None

Set next window scrolling value (use < 0.0f to not affect a given axis).

def set_next_window_bg_alpha(alpha: float) -> None

Set next window background color alpha. helper to easily override the Alpha component of Col.WINDOW_BG/ChildBg/PopupBg. you may also use WindowFlags.NO_BACKGROUND.

def set_window_pos(pos: tuple[float, float], cond: Cond = Cond.NONE) -> None

(not recommended) set current window position - call within begin()/end(). prefer using set_next_window_pos(), as this may incur tearing and side-effects.

def set_window_pos(name: str, pos: tuple[float, float], cond: Cond = Cond.NONE) -> None
def set_window_size(size: tuple[float, float], cond: Cond = Cond.NONE) -> None

(not recommended) set current window size - call within begin()/end(). set to ImVec2(0, 0) to force an auto-fit. prefer using set_next_window_size(), as this may incur tearing and minor side-effects.

def set_window_size(name: str, size: tuple[float, float], cond: Cond = Cond.NONE) -> None
def set_window_collapsed(collapsed: bool, cond: Cond = Cond.NONE) -> None

(not recommended) set current window collapsed state. prefer using set_next_window_collapsed().

def set_window_collapsed(name: str, collapsed: bool, cond: Cond = Cond.NONE) -> None
def set_window_focus() -> None

(not recommended) set current window to be focused / top-most. prefer using set_next_window_focus().

def set_window_focus(name: str) -> None
def set_window_font_scale(scale: float) -> None

[OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().

def set_window_pos(pos: tuple[float, float], cond: Cond = Cond.NONE) -> None

(not recommended) set current window position - call within begin()/end(). prefer using set_next_window_pos(), as this may incur tearing and side-effects.

def set_window_pos(name: str, pos: tuple[float, float], cond: Cond = Cond.NONE) -> None
def set_window_size(size: tuple[float, float], cond: Cond = Cond.NONE) -> None

(not recommended) set current window size - call within begin()/end(). set to ImVec2(0, 0) to force an auto-fit. prefer using set_next_window_size(), as this may incur tearing and minor side-effects.

def set_window_size(name: str, size: tuple[float, float], cond: Cond = Cond.NONE) -> None
def set_window_collapsed(collapsed: bool, cond: Cond = Cond.NONE) -> None

(not recommended) set current window collapsed state. prefer using set_next_window_collapsed().

def set_window_collapsed(name: str, collapsed: bool, cond: Cond = Cond.NONE) -> None
def set_window_focus() -> None

(not recommended) set current window to be focused / top-most. prefer using set_next_window_focus().

def set_window_focus(name: str) -> None

Windows Scrolling

Functions

def set_next_window_scroll(scroll: tuple[float, float]) -> None

Set next window scrolling value (use < 0.0f to not affect a given axis).

def get_scroll_x() -> float

Get scrolling amount [0 .. get_scroll_max_x()]

def get_scroll_y() -> float

Get scrolling amount [0 .. get_scroll_max_y()]

def set_scroll_x(scroll_x: float) -> None

Set scrolling amount [0 .. get_scroll_max_x()]

def set_scroll_y(scroll_y: float) -> None

Set scrolling amount [0 .. get_scroll_max_y()]

def get_scroll_max_x() -> float

Get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x

def get_scroll_max_y() -> float

Get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y

def set_scroll_here_x(center_x_ratio: float = 0.5) -> None

Adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using set_item_default_focus() instead.

def set_scroll_here_y(center_y_ratio: float = 0.5) -> None

Adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using set_item_default_focus() instead.

def set_scroll_from_pos_x(local_x: float, center_x_ratio: float = 0.5) -> None

Adjust scrolling amount to make given position visible. Generally get_cursor_start_pos() + offset to compute a valid position.

def set_scroll_from_pos_y(local_y: float, center_y_ratio: float = 0.5) -> None

Adjust scrolling amount to make given position visible. Generally get_cursor_start_pos() + offset to compute a valid position.

Parameter stacks (shared)

Functions

def push_font(font: Font | None) -> None

Use NULL as a shortcut to push default font

def pop_font() -> None
def push_style_color(idx: Col, col: int) -> None

Modify a style color. always use this if you modify the style after new_frame().

def push_style_color(idx: Col, col: tuple[float, float, float, float]) -> None
def push_style_color(idx: Col, col: tuple[float, float, float]) -> None
def pop_style_color(count: int = 1) -> None
def push_style_var(idx: StyleVar, val: float) -> None

Modify a style float variable. always use this if you modify the style after new_frame()!

def push_style_var(idx: StyleVar, val: tuple[float, float]) -> None
def push_style_var_x(idx: StyleVar, val_x: float) -> None

Modify X component of a style ImVec2 variable. "

def push_style_var_y(idx: StyleVar, val_y: float) -> None

Modify Y component of a style ImVec2 variable. "

def pop_style_var(count: int = 1) -> None

Parameter stacks (current window)

Functions

def push_item_width(item_width: float) -> None

Push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side).

def pop_item_width() -> None
def set_next_item_width(item_width: float) -> None

Set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side)

def calc_item_width() -> float

Width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions.

def push_text_wrap_pos(wrap_local_pos_x: float = 0.0) -> None
def pop_text_wrap_pos() -> None

Style read access

Functions

def get_font_size() -> float

Get current font size (= height in pixels) of current font with current scale applied

def get_font_tex_uv_white_pixel() -> tuple[float, float]

Get UV coordinate for a white pixel, useful to draw custom shapes via the ImDrawList API

def get_style_color_vec4(col: Col) -> tuple[float, float, float, float]

Retrieve style color as stored in ImGuiStyle structure. use to feed back into push_style_color(), otherwise use get_color_u32() to get style color with style alpha baked in.

Layout cursor positioning

Functions

def get_cursor_screen_pos() -> tuple[float, float]

Cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND (prefer using this rather than get_cursor_pos(), also more useful to work with ImDrawList API).

def set_cursor_screen_pos(pos: tuple[float, float]) -> None

Cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND.

def get_content_region_avail() -> tuple[float, float]

Available space from current position. THIS IS YOUR BEST FRIEND.

def get_cursor_pos() -> tuple[float, float]

[window-local] cursor position in window-local coordinates. This is not your best friend.

def get_cursor_pos_x() -> float

[window-local] "

def get_cursor_pos_y() -> float

[window-local] "

def set_cursor_pos(local_pos: tuple[float, float]) -> None

[window-local] "

def set_cursor_pos_x(local_x: float) -> None

[window-local] "

def set_cursor_pos_y(local_y: float) -> None

[window-local] "

def get_cursor_start_pos() -> tuple[float, float]

[window-local] initial cursor position, in window-local coordinates. Call get_cursor_screen_pos() after begin() to get the absolute coordinates version.

Other layout functions

Functions

def separator() -> None

Separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.

def same_line(offset_from_start_x: float = 0.0, spacing: float = -1.0) -> None

Call between widgets or groups to layout them horizontally. X position given in window coordinates.

def new_line() -> None

Undo a same_line() or force a new line when in a horizontal-layout context.

def spacing() -> None

Add vertical spacing.

def dummy(size: tuple[float, float]) -> None

Add a dummy item of given size. unlike invisible_button(), dummy() won't take the mouse click or be navigable into.

def indent(indent_w: float = 0.0) -> None

Move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0

def unindent(indent_w: float = 0.0) -> None

Move content position back to the left, by indent_w, or style.IndentSpacing if indent_w <= 0

def begin_group() -> None

Lock horizontal starting position

def end_group() -> None

Unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use is_item_hovered() or layout primitives such as same_line() on whole group, etc.)

def align_text_to_frame_padding() -> None

Vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item)

def get_text_line_height() -> float

~ FontSize

def get_text_line_height_with_spacing() -> float

~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)

def get_frame_height() -> float

~ FontSize + style.FramePadding.y * 2

def get_frame_height_with_spacing() -> float

~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)

ID stack/scopes

Read the FAQ (docs/FAQ.md or http://dearimgui.com/faq) for more details about how ID are handled in dear imgui.

Those questions are answered and impacted by understanding of the ID stack system:

Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.

You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.

In this header file we use the label/name terminology to denote a string that will be displayed + used as an ID, whereas str_id denote a string that is only used as an ID and not normally displayed.

Functions

def push_id(str_id: str) -> None

Push string into the ID stack (will hash string).

def push_id(int_id: int) -> None
def pop_id() -> None

Pop from the ID stack.

Widgets: Text

Functions

def text(text: str) -> None

Formatted text

def text_colored(col: tuple[float, float, float, float], text: str) -> None
def text_disabled(text: str) -> None
def text_wrapped(text: str) -> None
def label_text(label: str, text: str) -> None

Display text+label aligned the same way as value+label widgets

def bullet_text(text: str) -> None

Shortcut for bullet()+text()

def separator_text(text: str) -> None

Currently: formatted text with a horizontal line

Widgets: Main

Functions

def button(label: str, size: tuple[float, float] = (0.0, 0.0)) -> bool

Button

def small_button(label: str) -> bool

Button with (FramePadding.y == 0) to easily embed within text

def invisible_button(str_id: str, size: tuple[float, float], flags: ButtonFlags = ButtonFlags.NONE) -> bool

Flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with is_item_active, is_item_hovered, etc.)

def arrow_button(str_id: str, dir: Dir) -> bool

Square button with an arrow shape

def checkbox(label: str, v: bool) -> tuple[bool, bool]
def checkbox_flags(label: str, flags: int, flags_value: int) -> tuple[bool, int]
def radio_button(label: str, active: bool) -> bool
def radio_button(label: str, v: int, v_button: int) -> tuple[bool, int]
def progress_bar(fraction: float, size_arg: tuple[float, float] = (-FLT_MIN, 0), overlay: str | None = None) -> None
def bullet() -> None

Draw a small circle + keep the cursor on the same line. advance cursor x position by get_tree_node_to_label_spacing(), same distance that tree_node() uses

def text_link(label: str) -> None

Hyperlink text button, return true when clicked

def text_link_open_url(label: str, url: str | None = None) -> None

Hyperlink text button, automatically open file/url when clicked

Widgets: Images

Functions

def image(user_texture_id: int, image_size: tuple[float, float], uv0: tuple[float, float] = (0.0, 0.0), uv1: tuple[float, float] = (1.0, 1.0)) -> None
def image_with_bg(user_texture_id: int, image_size: tuple[float, float], uv0: tuple[float, float] = (0.0, 0.0), uv1: tuple[float, float] = (1.0, 1.0), bg_col: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), tint_col: tuple[float, float, float, float] = (1.0, 1.0, 1.0, 1.0)) -> None
def image_button(str_id: str, user_texture_id: int, image_size: tuple[float, float], uv0: tuple[float, float] = (0.0, 0.0), uv1: tuple[float, float] = (1.0, 1.0), bg_col: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), tint_col: tuple[float, float, float, float] = (1.0, 1.0, 1.0, 1.0)) -> bool

Widgets: Combo Box (Dropdown)

Functions

def begin_combo(label: str, preview_value: str, flags: ComboFlags = ComboFlags.NONE) -> bool
def end_combo() -> None

Only call end_combo() if begin_combo() returns true!

def combo(label: str, current_item: int, items: Sequence[str], popup_max_height_in_items: int = -1) -> tuple[bool, int]

Widgets: Drag Sliders

Functions

def drag_float(label: str, v: float, v_speed: float = 1.0, v_min: float = 0.0, v_max: float = 0.0, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, float]

If v_min >= v_max we have no bound

def drag_float2(label: str, v: tuple[float, float], v_speed: float = 1.0, v_min: float = 0.0, v_max: float = 0.0, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float]]
def drag_float3(label: str, v: tuple[float, float, float], v_speed: float = 1.0, v_min: float = 0.0, v_max: float = 0.0, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float, float]]
def drag_float4(label: str, v: tuple[float, float, float, float], v_speed: float = 1.0, v_min: float = 0.0, v_max: float = 0.0, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float, float, float]]
def drag_int(label: str, v: int, v_speed: float = 1.0, v_min: int = 0, v_max: int = 0, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, int]

If v_min >= v_max we have no bound

def drag_int2(label: str, v: tuple[int, int], v_speed: float = 1.0, v_min: int = 0, v_max: int = 0, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int]]
def drag_int3(label: str, v: tuple[int, int, int], v_speed: float = 1.0, v_min: int = 0, v_max: int = 0, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int, int]]
def drag_int4(label: str, v: tuple[int, int, int, int], v_speed: float = 1.0, v_min: int = 0, v_max: int = 0, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int, int, int]]

Widgets: Regular Sliders

Functions

def slider_float(label: str, v: float, v_min: float, v_max: float, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, float]

Adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.

def slider_float2(label: str, v: tuple[float, float], v_min: float, v_max: float, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float]]
def slider_float3(label: str, v: tuple[float, float, float], v_min: float, v_max: float, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float, float]]
def slider_float4(label: str, v: tuple[float, float, float, float], v_min: float, v_max: float, format: str = '%.3f', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[float, float, float, float]]
def slider_angle(label: str, v: float, v_degrees_min: float = -360.0, v_degrees_max: float = 360.0, format: str = '%.0f deg', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, float]
def slider_int(label: str, v: int, v_min: int, v_max: int, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, int]
def slider_int2(label: str, v: tuple[int, int], v_min: int, v_max: int, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int]]
def slider_int3(label: str, v: tuple[int, int, int], v_min: int, v_max: int, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int, int]]
def slider_int4(label: str, v: tuple[int, int, int, int], v_min: int, v_max: int, format: str = '%d', flags: SliderFlags = SliderFlags.NONE) -> tuple[bool, tuple[int, int, int, int]]

Widgets: Input with Keyboard

Functions

def input_text(label: str, text: str, flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, str]
def input_text_multiline(label: str, text: str, size: tuple[float, float] = (0.0, 0.0), flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, str]
def input_text_with_hint(label: str, hint: str, text: str, flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, str]
def input_float(label: str, v: float, step: float = 0.0, step_fast: float = 0.0, format: str = '%.3f', flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, float]
def input_float2(label: str, v: tuple[float, float], format: str = '%.3f', flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[float, float]]
def input_float3(label: str, v: tuple[float, float, float], format: str = '%.3f', flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[float, float, float]]
def input_float4(label: str, v: tuple[float, float, float, float], format: str = '%.3f', flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[float, float, float, float]]
def input_int(label: str, v: int, step: int = 1, step_fast: int = 100, flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, int]
def input_int2(label: str, v: tuple[int, int], flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[int, int]]
def input_int3(label: str, v: tuple[int, int, int], flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[int, int, int]]
def input_int4(label: str, v: tuple[int, int, int, int], flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, tuple[int, int, int, int]]
def input_double(label: str, v: float, step: float = 0.0, step_fast: float = 0.0, format: str = '%.6f', flags: InputTextFlags = InputTextFlags.NONE) -> tuple[bool, float]

Widgets: Color Editor/Picker

Tip: the color_edit_* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.

Functions

def color_edit3(label: str, col: tuple[float, float, float], flags: ColorEditFlags = ColorEditFlags.NONE) -> tuple[bool, tuple[float, float, float]]
def color_edit4(label: str, col: tuple[float, float, float, float], flags: ColorEditFlags = ColorEditFlags.NONE) -> tuple[bool, tuple[float, float, float, float]]
def color_picker3(label: str, col: tuple[float, float, float], flags: ColorEditFlags = ColorEditFlags.NONE) -> tuple[bool, tuple[float, float, float]]
def color_picker4(label: str, col: tuple[float, float, float, float], flags: ColorEditFlags = ColorEditFlags.NONE, ref_col: tuple[float, float, float, float] | None = None) -> tuple[bool, tuple[float, float, float, float]]
def color_button(desc_id: str, col: tuple[float, float, float, float], flags: ColorEditFlags = ColorEditFlags.NONE, size: tuple[float, float] = (0.0, 0.0)) -> bool

Display a color square/button, hover for details, return true when pressed.

def set_color_edit_options(flags: ColorEditFlags) -> None

Initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.

Widgets: Trees

Functions

def tree_node(label: str, flags: TreeNodeFlags = TreeNodeFlags.NONE) -> bool
def tree_node(str_id: str, text: str, flags: TreeNodeFlags = TreeNodeFlags.NONE) -> bool
def tree_push(str_id: str) -> None

~ indent()+push_id(). Already called by tree_node() when returning true, but you can call tree_push/tree_pop yourself if desired.

def tree_pop() -> None

~ unindent()+pop_id()

def get_tree_node_to_label_spacing() -> float

Horizontal distance preceding label when using tree_node*() or bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed tree_node

def collapsing_header(label: str, visible: bool | None = None, flags: TreeNodeFlags = TreeNodeFlags.NONE) -> tuple[bool, bool | None]

If returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call tree_pop().

def set_next_item_open(is_open: bool, cond: Cond = Cond.NONE) -> None

Set next tree_node/collapsing_header open state.

Widgets: Selectables

Functions

def selectable(label: str, selected: bool = False, flags: SelectableFlags = SelectableFlags.NONE, size: tuple[float, float] = (0.0, 0.0)) -> tuple[bool, bool]

"bool selected" carry the selection state (read-only). selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height

Multi-selection system for selectable(), checkbox(), tree_node() functions [BETA]

Widgets: List Boxes

Functions

def begin_list_box(label: str, size: tuple[float, float] = (0.0, 0.0)) -> bool

Open a framed scrolling region

def end_list_box() -> None

Only call end_list_box() if begin_list_box() returned true!

def list_box(label: str, current_item: int, items: Sequence[str], height_in_items: int = -1) -> tuple[bool, int]

Widgets: Data Plotting

Consider using ImPlot (https://github.com/epezent/implot) which is much better! Slimgui includes ImPlot bindings, which can be imported with from slimgui import implot.

Functions

def plot_lines(label: str, values: Annotated[ArrayLike, dict(dtype='float32', shape=(None), device='cpu', writable=False)], overlay_text: str | None = None, scale_min: float = FLT_MAX, scale_max: float = FLT_MAX, graph_size: tuple[float, float] = (0.0, 0.0)) -> None
def plot_histogram(label: str, values: Annotated[ArrayLike, dict(dtype='float32', shape=(None), device='cpu', writable=False)], overlay_text: str | None = None, scale_min: float = FLT_MAX, scale_max: float = FLT_MAX, graph_size: tuple[float, float] = (0.0, 0.0)) -> None

Widgets: Value() Helpers

These are merely shortcuts to calling text() with a format string. Output single value in “name: value” format.

Functions

Widgets: Menus

Functions

def begin_menu_bar() -> bool

Append to menu-bar of current window (requires WindowFlags.MENU_BAR flag set on parent window).

def end_menu_bar() -> None

Only call end_menu_bar() if begin_menu_bar() returns true!

def begin_main_menu_bar() -> bool

Create and append to a full screen menu-bar.

def end_main_menu_bar() -> None

Only call end_main_menu_bar() if begin_main_menu_bar() returns true!

def begin_menu(label: str, enabled: bool = True) -> bool

Create a sub-menu entry. only call end_menu() if this returns true!

def end_menu() -> None

Only call end_menu() if begin_menu() returns true!

def menu_item(label: str, shortcut: str | None = None, selected: bool = False, enabled: bool = True) -> tuple[bool, bool]

Return true when activated.

Tooltips

def begin_tooltip() -> bool

Begin/append a tooltip window.

def end_tooltip() -> None

Only call end_tooltip() if begin_tooltip()/begin_item_tooltip() returns true!

def set_tooltip(text: str) -> None

Set a text-only tooltip. Often used after a ImGui::is_item_hovered() check. Override any previous call to set_tooltip().

Tooltip helpers

Tooltip helpers for showing a tooltip when hovering an item:

Functions

def begin_item_tooltip() -> bool

Begin/append a tooltip window if preceding item was hovered.

def set_item_tooltip(text: str) -> None

Set a text-only tooltip if preceding item was hovered. override any previous call to set_tooltip().

Popups, Modals

Functions

def begin_popup(str_id: str, flags: WindowFlags = WindowFlags.NONE) -> bool

Return true if the popup is open, and you can start outputting to it.

def end_popup() -> None

Only call end_popup() if BeginPopupXXX() returns true!

Popups: open/close functions

Functions

def open_popup(str_id: str, flags: PopupFlags = PopupFlags.NONE) -> None

Call to mark popup as open (don't call every frame!).

def open_popup_on_item_click(str_id: str | None = None, flags: PopupFlags = PopupFlags.MOUSE_BUTTON_RIGHT) -> None

Helper to open popup when clicked on last item. Default to PopupFlags.MOUSE_BUTTON_RIGHT == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)

def close_current_popup() -> None

Manually close the popup we have begin-ed into.

Popups: open+begin combined functions helpers

Functions

def begin_popup_context_window(str_id: str | None = None, flags: PopupFlags = PopupFlags.MOUSE_BUTTON_RIGHT) -> bool

Open+begin popup when clicked on current window.

Popups: query functions

Functions

def is_popup_open(str_id: str, flags: PopupFlags = PopupFlags.NONE) -> bool

Return true if the popup is open.

Tables

The typical call flow is:

  1. Call begin_table(), early out if returning False.
  2. Optionally call table_setup_column() to submit column name/flags/defaults.
  3. Optionally call table_setup_scroll_freeze() to request scroll freezing of columns/rows.
  4. Optionally call table_headers_row() to submit a header row. Names are pulled from table_setup_column() data.
  5. Populate contents:
  1. Call end_table()

Functions

def begin_table(str_id: str, column: int, flags: TableFlags = TableFlags.NONE, outer_size: tuple[float, float] = (0.0, 0.0), inner_width: float = 0.0) -> bool
def end_table() -> None

Only call end_table() if begin_table() returns true!

def table_next_row(flags: TableRowFlags = TableRowFlags.NONE, min_row_height: float = 0.0) -> None

Append into the first cell of a new row.

def table_next_column() -> bool

Append into the next column (or first column of next row if currently in last column). Return true when column is visible.

def table_set_column_index(column_n: int) -> bool

Append into the specified column. Return true when column is visible.

Tables: Headers & Columns declaration

Functions

def table_setup_column(label: str, flags: TableColumnFlags = TableColumnFlags.NONE, init_width_or_weight: float = 0.0, user_id: int = 0) -> None
def table_setup_scroll_freeze(cols: int, rows: int) -> None

Lock columns/rows so they stay visible when scrolled.

def table_header(label: str) -> None

Submit one header cell manually (rarely used)

def table_headers_row() -> None

Submit a row with headers cells based on data provided to table_setup_column() + submit context menu

def table_angled_headers_row() -> None

Submit a row with angled headers for every column with the TableColumnFlags.ANGLED_HEADER flag. MUST BE FIRST ROW.

Tables: Sorting & Miscellaneous functions

Functions

def table_get_column_count() -> int

Return number of columns (value passed to begin_table)

def table_get_column_index() -> int

Return current column index.

def table_get_row_index() -> int

Return current row index.

def table_get_column_name(column_n: int = -1) -> str

Return "" if column didn't have a name declared by table_setup_column(). Pass -1 to use current column.

def table_get_column_flags(column_n: int = -1) -> TableColumnFlags

Return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.

def table_set_column_enabled(column_n: int, v: bool) -> None

Change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with TableFlags.CONTEXT_MENU_IN_BODY)

def table_set_bg_color(target: TableBgTarget, color: tuple[float, float, float, float], column_n: int = -1) -> None

Change the color of a cell, row, or column. See TableBgTarget flags for details.

Legacy Columns API (prefer using Tables!)

Functions

def columns(count: int = 1, id: str | None = None, border: bool = True) -> None
def next_column() -> None

Next column, defaults to current row or next row if the current row is finished

def get_column_index() -> int

Get current column index

def get_column_width(column_index: int = -1) -> float

Get column width (in pixels). pass -1 to use current column

def set_column_width(column_index: int, width: float) -> None

Set column width (in pixels). pass -1 to use current column

def get_column_offset(column_index: int = -1) -> float

Get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..get_columns_count() inclusive. column 0 is typically 0.0f

def set_column_offset(column_index: int, offset_x: float) -> None

Set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column

def get_columns_count() -> int

Tab Bars, Tabs

Functions

def begin_tab_bar(str_id: str, flags: TabBarFlags = TabBarFlags.NONE) -> bool

Create and append into a TabBar

def end_tab_bar() -> None

Only call end_tab_bar() if begin_tab_bar() returns true!

def tab_item_button(label: str, flags: TabItemFlags = TabItemFlags.NONE) -> bool

Create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar.

def set_tab_item_closed(label: str) -> None

Notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after begin_tab_bar() and before Tab submissions. Otherwise call with a window name.

def begin_tab_item(str_id: str, closable: bool = False, flags: TabItemFlags = TabItemFlags.NONE) -> tuple[bool, bool]

Create a Tab. Returns true if the Tab is selected.

When the closable argument is set to True, the created tab will display a close button. The second bool of the return value will be False if the close button was pressed. The intended usage is as follows:

tab_open = True  # open/closed state

visible, tab_open = imgui.begin_tab_item(..., closable=tab_open)
if visible:
    # render tab contents here..
def end_tab_item() -> None

Only call end_tab_item() if begin_tab_item() returns true!

Disabling [BETA API]

Functions

def begin_disabled(disabled: bool = True) -> None
def end_disabled() -> None

Clipping

Functions

def push_clip_rect(clip_rect_min: tuple[float, float], clip_rect_max: tuple[float, float], intersect_with_current_clip_rect: bool) -> None
def pop_clip_rect() -> None

Focus, Activation

Functions

def set_item_default_focus() -> None

Make last item the default focused item of a newly appearing window.

def set_keyboard_focus_here(offset: int = 0) -> None

Focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.

Keyboard/Gamepad Navigation

def set_nav_cursor_visible(visible: bool) -> None

Alter visibility of keyboard/gamepad cursor. by default: show when using an arrow key, hide when clicking with mouse.

Overlapping mode

Functions

def set_next_item_allow_overlap() -> None

Allow next item to be overlapped by a subsequent item. Useful with invisible buttons, selectable, treenode covering an area where subsequent items may need to be added. Note that both selectable() and tree_node() have dedicated flags doing this.

Item/Widgets Utilities and Query Functions

Functions

def is_item_hovered(flags: HoveredFlags = HoveredFlags.NONE) -> bool

Is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.

def is_item_active() -> bool

Is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)

def is_item_focused() -> bool

Is the last item focused for keyboard/gamepad navigation?

def is_item_clicked(mouse_button: MouseButton = MouseButton.LEFT) -> bool

Is the last item hovered and mouse clicked on? (**) == is_mouse_clicked(mouse_button) && is_item_hovered()Important. (**) this is NOT equivalent to the behavior of e.g. button(). Read comments in function definition.

def is_item_visible() -> bool

Is the last item visible? (items may be out of sight because of clipping/scrolling)

def is_item_edited() -> bool

Did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets.

def is_item_activated() -> bool

Was the last item just made active (item was previously inactive).

def is_item_deactivated() -> bool

Was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that require continuous editing.

def is_item_deactivated_after_edit() -> bool

Was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that require continuous editing. Note that you may get false positives (some widgets such as combo()/list_box()/selectable() will return true even when clicking an already selected item).

def is_item_toggled_open() -> bool

Was the last item open state toggled? set by tree_node().

def is_any_item_hovered() -> bool

Is any item hovered?

def is_any_item_active() -> bool

Is any item active?

def is_any_item_focused() -> bool

Is any item focused?

def get_item_rect_min() -> tuple[float, float]

Get upper-left bounding rectangle of the last item (screen space)

def get_item_rect_max() -> tuple[float, float]

Get lower-right bounding rectangle of the last item (screen space)

def get_item_rect_size() -> tuple[float, float]

Get size of last item

Viewports

Functions

def get_main_viewport() -> Viewport

Return primary/default viewport. This can never be NULL.

Background/Foreground Draw Lists

Functions

Miscellaneous Utilities

Functions

def is_rect_visible(size: tuple[float, float]) -> bool

Test if rectangle (of given size, starting from cursor position) is visible / not clipped.

def is_rect_visible(rect_min: tuple[float, float], rect_max: tuple[float, float]) -> bool
def get_time() -> float

Get global imgui time. incremented by io.DeltaTime every frame.

def get_frame_count() -> int

Get global imgui frame count. incremented by 1 every frame.

def get_style_color_name(col: Col) -> str

Get a string corresponding to the enum value (for display, saving, etc.).

Text Utilities

Functions

def calc_text_size(text: str, hide_text_after_double_hash: bool = False, wrap_width: float = -1.0) -> tuple[float, float]

Color Utilities

Functions

def color_convert_u32_to_float4(arg: int, /) -> tuple[float, float, float, float]
def color_convert_float4_to_u32(arg: tuple[float, float, float, float], /) -> int
def color_convert_rgb_to_hsv(rgba: tuple[float, float, float, float]) -> tuple[float, float, float, float]
def color_convert_hsv_to_rgb(hsv: tuple[float, float, float, float]) -> tuple[float, float, float, float]

Inputs Utilities: Keyboard/Mouse/Gamepad

Functions

def is_key_down(key: Key) -> bool

Is key being held.

def is_key_pressed(key: Key, repeat: bool = True) -> bool

Was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate

def is_key_released(key: Key) -> bool

Was key released (went from Down to !Down)?

def is_key_chord_pressed(key_chord: Key) -> bool

Was key chord (mods + key) pressed, e.g. you can pass 'ImGuiMod_Ctrl | ImGuiKey_S' as a key-chord. This doesn't do any routing or focus check, please consider using shortcut() function instead.

def get_key_pressed_amount(key: Key, repeat_delay: float, rate: float) -> int

Uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate

def get_key_name(key: Key) -> str

[DEBUG] returns English name of the key. Those names are provided for debugging purpose and are not meant to be saved persistently nor compared.

def set_next_frame_want_capture_keyboard(want_capture_keyboard: bool) -> None

Inputs Utilities: Mouse

def is_mouse_down(button: MouseButton) -> bool

Is mouse button held?

def is_mouse_clicked(button: MouseButton, repeat: bool = False) -> bool

Did mouse button clicked? (went from !Down to Down). Same as get_mouse_clicked_count() == 1.

def is_mouse_released(button: MouseButton) -> bool

Did mouse button released? (went from Down to !Down)

def is_mouse_double_clicked(button: MouseButton) -> bool

Did mouse button double-clicked? Same as get_mouse_clicked_count() == 2. (note that a double-click will also report is_mouse_clicked() == true)

def is_mouse_released_with_delay(button: MouseButton, delay: float) -> bool

Delayed mouse release (use very sparingly!). Generally used with 'delay >= io.MouseDoubleClickTime' + combined with a 'io.MouseClickedLastCount==1' test. This is a very rarely used UI idiom, but some apps use this: e.g. MS Explorer single click on an icon to rename.

def get_mouse_clicked_count(button: MouseButton) -> int

Return the number of successive mouse-clicks at the time where a click happen (otherwise 0).

def is_mouse_hovering_rect(r_min: tuple[float, float], r_max: tuple[float, float], clip: bool = True) -> bool

Is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.

def is_mouse_pos_valid(mouse_pos: tuple[float, float] | None = None) -> bool

By convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available

def get_mouse_pos() -> tuple[float, float]

Shortcut to ImGui::get_io().MousePos provided by user, to be consistent with other calls

def get_mouse_pos_on_opening_current_popup() -> tuple[float, float]

Retrieve mouse position at the time of opening popup we have begin_popup() into (helper to avoid user backing that value themselves)

def is_mouse_dragging(button: MouseButton, lock_threshold: float = -1.0) -> bool

Is mouse dragging? (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)

def get_mouse_drag_delta(button: MouseButton = MouseButton.LEFT, lock_threshold: float = -1.0) -> tuple[float, float]

Return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)

def reset_mouse_drag_delta(button: MouseButton = MouseButton.LEFT) -> None
def get_mouse_cursor() -> MouseCursor

Get desired mouse cursor shape. Important: reset in ImGui::new_frame(), this is updated during the frame. valid before render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you

def set_mouse_cursor(cursor_type: MouseCursor) -> None

Set desired mouse cursor shape

def set_next_frame_want_capture_mouse(capture: bool) -> None

Enum Reference

BackendFlags (enum)
NONE
HAS_GAMEPADBackend Platform supports gamepad and currently has one connected.
HAS_MOUSE_CURSORSBackend Platform supports honoring get_mouse_cursor() value to change the OS cursor shape.
HAS_SET_MOUSE_POSBackend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if io.ConfigNavMoveSetMousePos is set).
RENDERER_HAS_VTX_OFFSETBackend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices.
ButtonFlags (enum)
NONE
MOUSE_BUTTON_LEFTReact on left mouse button (default)
MOUSE_BUTTON_RIGHTReact on right mouse button
MOUSE_BUTTON_MIDDLEReact on center mouse button
ENABLE_NAVinvisible_button(): do not disable navigation/tabbing. Otherwise disabled by default.
ChildFlags (enum)
NONE
BORDERSShow an outer border and enable WindowPadding. (IMPORTANT: this is always == 1 == true for legacy reason)
ALWAYS_USE_WINDOW_PADDINGPad with style.WindowPadding even if no border are drawn (no padding by default for non-bordered child windows because it makes more sense)
RESIZE_XAllow resize from right border (layout direction). Enable .ini saving (unless WindowFlags.NO_SAVED_SETTINGS passed to window flags)
RESIZE_YAllow resize from bottom border (layout direction).
AUTO_RESIZE_XEnable auto-resizing width. Read IMPORTANT: Size measurement" details above.
AUTO_RESIZE_YEnable auto-resizing height. Read IMPORTANT: Size measurement" details above.
ALWAYS_AUTO_RESIZECombined with AutoResizeX/AutoResizeY. Always measure size even when child is hidden, always return true, always disable clipping optimization! NOT RECOMMENDED.
FRAME_STYLEStyle the child window like a framed item: use FrameBg, FrameRounding, FrameBorderSize, FramePadding instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.
NAV_FLATTENED[BETA] Share focus scope, allow keyboard/gamepad navigation to cross over parent border to this child or between sibling child windows.
Col (enum)
TEXT
TEXT_DISABLED
WINDOW_BGBackground of normal windows
CHILD_BGBackground of child windows
POPUP_BGBackground of popups, menus, tooltips windows
BORDER
BORDER_SHADOW
FRAME_BGBackground of checkbox, radio button, plot, slider, text input
FRAME_BG_HOVERED
FRAME_BG_ACTIVE
TITLE_BGTitle bar
TITLE_BG_ACTIVETitle bar when focused
TITLE_BG_COLLAPSEDTitle bar when collapsed
MENU_BAR_BG
SCROLLBAR_BG
SCROLLBAR_GRAB
SCROLLBAR_GRAB_HOVERED
SCROLLBAR_GRAB_ACTIVE
CHECK_MARKcheckbox tick and radio_button circle
SLIDER_GRAB
SLIDER_GRAB_ACTIVE
BUTTON
BUTTON_HOVERED
BUTTON_ACTIVE
HEADERHeader* colors are used for collapsing_header, tree_node, selectable, menu_item
HEADER_HOVERED
HEADER_ACTIVE
SEPARATOR
SEPARATOR_HOVERED
SEPARATOR_ACTIVE
RESIZE_GRIPResize grip in lower-right and lower-left corners of windows.
RESIZE_GRIP_HOVERED
RESIZE_GRIP_ACTIVE
TAB_HOVEREDTab background, when hovered
TABTab background, when tab-bar is focused & tab is unselected
TAB_SELECTEDTab background, when tab-bar is focused & tab is selected
TAB_SELECTED_OVERLINETab horizontal overline, when tab-bar is focused & tab is selected
TAB_DIMMEDTab background, when tab-bar is unfocused & tab is unselected
TAB_DIMMED_SELECTEDTab background, when tab-bar is unfocused & tab is selected
TAB_DIMMED_SELECTED_OVERLINE
PLOT_LINES
PLOT_LINES_HOVERED
PLOT_HISTOGRAM
PLOT_HISTOGRAM_HOVERED
TABLE_HEADER_BGTable header background
TABLE_BORDER_STRONGTable outer and header borders (prefer using Alpha=1.0 here)
TABLE_BORDER_LIGHTTable inner borders (prefer using Alpha=1.0 here)
TABLE_ROW_BGTable row background (even rows)
TABLE_ROW_BG_ALTTable row background (odd rows)
TEXT_LINKHyperlink color
TEXT_SELECTED_BG
DRAG_DROP_TARGETRectangle highlighting a drop target
NAV_CURSORColor of keyboard/gamepad navigation cursor/rectangle, when visible
NAV_WINDOWING_HIGHLIGHTHighlight window when using CTRL+TAB
NAV_WINDOWING_DIM_BGDarken/colorize entire screen behind the CTRL+TAB window list, when active
MODAL_WINDOW_DIM_BGDarken/colorize entire screen behind a modal window, when one is active
COUNT
ColorEditFlags (enum)
NONE
NO_ALPHAColorEdit, ColorPicker, color_button: ignore Alpha component (will only read 3 components from the input pointer).
NO_PICKERColorEdit: disable picker when clicking on color square.
NO_OPTIONSColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
NO_SMALL_PREVIEWColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs)
NO_INPUTSColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square).
NO_TOOLTIPColorEdit, ColorPicker, color_button: disable tooltip when hovering the preview.
NO_LABELColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).
NO_SIDE_PREVIEWColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead.
NO_DRAG_DROPColorEdit: disable drag and drop target. color_button: disable drag and drop source.
NO_BORDERcolor_button: disable border (which is enforced by default)
ALPHA_OPAQUEColorEdit, ColorPicker, color_button: disable alpha in the preview,. Contrary to _NoAlpha it may still be edited when calling color_edit4()/color_picker4(). For color_button() this does the same as _NoAlpha.
ALPHA_NO_BGColorEdit, ColorPicker, color_button: disable rendering a checkerboard background behind transparent color.
ALPHA_PREVIEW_HALFColorEdit, ColorPicker, color_button: display half opaque / half transparent preview.
ALPHA_BARColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
HDR(WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ColorEditFlags.FLOAT flag as well).
DISPLAY_RGBColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex.
DISPLAY_HSV
DISPLAY_HEX
UINT8ColorEdit, ColorPicker, color_button: _display_ values formatted as 0..255.
FLOATColorEdit, ColorPicker, color_button: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
PICKER_HUE_BARColorPicker: bar for Hue, rectangle for Sat/Value.
PICKER_HUE_WHEELColorPicker: wheel for Hue, triangle for Sat/Value.
INPUT_RGBColorEdit, ColorPicker: input and output data in RGB format.
INPUT_HSVColorEdit, ColorPicker: input and output data in HSV format.
ComboFlags (enum)
NONE
POPUP_ALIGN_LEFTAlign the popup toward the left by default
HEIGHT_SMALLMax ~4 items visible. Tip: If you want your combo popup to be a specific size you can use set_next_window_size_constraints() prior to calling begin_combo()
HEIGHT_REGULARMax ~8 items visible (default)
HEIGHT_LARGEMax ~20 items visible
HEIGHT_LARGESTAs many fitting items as possible
NO_ARROW_BUTTONDisplay on the preview box without the square arrow button
NO_PREVIEWDisplay only a square arrow button
WIDTH_FIT_PREVIEWWidth dynamically calculated from preview contents
Cond (enum)
NONENo condition (always set the variable), same as _Always
ALWAYSNo condition (always set the variable), same as _None
ONCESet the variable once per runtime session (only the first call will succeed)
FIRST_USE_EVERSet the variable if the object/window has no persistently saved data (no entry in .ini file)
APPEARINGSet the variable if the object/window is appearing after being hidden/inactive (or the first time)
ConfigFlags (enum)
NONE
NAV_ENABLE_KEYBOARDMaster keyboard navigation enable flag. Enable full Tabbing + directional arrows + space/enter to activate.
NAV_ENABLE_GAMEPADMaster gamepad navigation enable flag. Backend also needs to set BackendFlags.HAS_GAMEPAD.
NO_MOUSEInstruct dear imgui to disable mouse inputs and interactions.
NO_MOUSE_CURSOR_CHANGEInstruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use set_mouse_cursor() to change mouse cursor. You may want to honor requests from imgui by reading get_mouse_cursor() yourself instead.
NO_KEYBOARDInstruct dear imgui to disable keyboard inputs and interactions. This is done by ignoring keyboard events and clearing existing states.
IS_SRGBApplication is SRGB-aware.
IS_TOUCH_SCREENApplication is using a touch screen instead of a mouse.
Dir (enum)
NONE
LEFT
RIGHT
UP
DOWN
COUNT
DragDropFlags (enum)
NONE
SOURCE_NO_PREVIEW_TOOLTIPDisable preview tooltip. By default, a successful call to begin_drag_drop_source opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior.
SOURCE_NO_DISABLE_HOVERBy default, when dragging we clear data so that is_item_hovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call is_item_hovered() on the source item.
SOURCE_NO_HOLD_TO_OPEN_OTHERSDisable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
SOURCE_ALLOW_NULL_IDAllow items such as text(), image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
SOURCE_EXTERNExternal source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
PAYLOAD_AUTO_EXPIREAutomatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged)
PAYLOAD_NO_CROSS_CONTEXTHint to specify that the payload may not be copied outside current dear imgui context.
PAYLOAD_NO_CROSS_PROCESSHint to specify that the payload may not be copied outside current process.
ACCEPT_BEFORE_DELIVERYaccept_drag_drop_payload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
ACCEPT_NO_DRAW_DEFAULT_RECTDo not draw the default highlight rectangle when hovering over target.
ACCEPT_NO_PREVIEW_TOOLTIPRequest hiding the begin_drag_drop_source tooltip from the begin_drag_drop_target site.
ACCEPT_PEEK_ONLYFor peeking ahead and inspecting the payload before delivery.
DrawFlags (enum)
NONE
CLOSEDPathStroke(), AddPolyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason)
ROUND_CORNERS_TOP_LEFTAddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners). Was 0x01.
ROUND_CORNERS_TOP_RIGHTAddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners). Was 0x02.
ROUND_CORNERS_BOTTOM_LEFTAddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners). Was 0x04.
ROUND_CORNERS_BOTTOM_RIGHTAddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding > 0.0f, we default to all corners). Wax 0x08.
ROUND_CORNERS_NONEAddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag!
ROUND_CORNERS_TOP
ROUND_CORNERS_BOTTOM
ROUND_CORNERS_LEFT
ROUND_CORNERS_RIGHT
ROUND_CORNERS_ALL
FocusedFlags (enum)
NONE
CHILD_WINDOWSReturn true if any children of the window is focused
ROOT_WINDOWTest from root window (top most parent of the current hierarchy)
ANY_WINDOWReturn true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
NO_POPUP_HIERARCHYDo not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
ROOT_AND_CHILD_WINDOWS
HoveredFlags (enum)
NONEReturn true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
CHILD_WINDOWSis_window_hovered() only: Return true if any children of the window is hovered
ROOT_WINDOWis_window_hovered() only: Test from root window (top most parent of the current hierarchy)
ANY_WINDOWis_window_hovered() only: Return true if any window is hovered
NO_POPUP_HIERARCHYis_window_hovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
ALLOW_WHEN_BLOCKED_BY_POPUPReturn true even if a popup window is normally blocking access to this item/window
ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEMReturn true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
ALLOW_WHEN_OVERLAPPED_BY_ITEMis_item_hovered() only: Return true even if the item uses AllowOverlap mode and is overlapped by another hoverable item.
ALLOW_WHEN_OVERLAPPED_BY_WINDOWis_item_hovered() only: Return true even if the position is obstructed or overlapped by another window.
ALLOW_WHEN_DISABLEDis_item_hovered() only: Return true even if the item is disabled
NO_NAV_OVERRIDEis_item_hovered() only: Disable using keyboard/gamepad navigation state when active, always query mouse
ALLOW_WHEN_OVERLAPPED
RECT_ONLY
ROOT_AND_CHILD_WINDOWS
FOR_TOOLTIPShortcut for standard flags when using is_item_hovered() + set_tooltip() sequence.
STATIONARYRequire mouse to be stationary for style.HoverStationaryDelay (~0.15 sec) _at least one time_. After this, can move on same item/window. Using the stationary test tends to reduces the need for a long delay.
DELAY_NONEis_item_hovered() only: Return true immediately (default). As this is the default you generally ignore this.
DELAY_SHORTis_item_hovered() only: Return true after style.HoverDelayShort elapsed (~0.15 sec) (shared between items) + requires mouse to be stationary for style.HoverStationaryDelay (once per item).
DELAY_NORMALis_item_hovered() only: Return true after style.HoverDelayNormal elapsed (~0.40 sec) (shared between items) + requires mouse to be stationary for style.HoverStationaryDelay (once per item).
NO_SHARED_DELAYis_item_hovered() only: Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays)
InputTextFlags (enum)
NONE
CHARS_DECIMALAllow 0123456789.+-*/
CHARS_HEXADECIMALAllow 0123456789ABCDEFabcdef
CHARS_SCIENTIFICAllow 0123456789.+-*/eE (Scientific notation input)
CHARS_UPPERCASETurn a..z into A..Z
CHARS_NO_BLANKFilter out spaces, tabs
ALLOW_TAB_INPUTPressing TAB input a ' ' character into the text field
ENTER_RETURNS_TRUEReturn 'true' when Enter is pressed (as opposed to every time the value was modified). Consider using is_item_deactivated_after_edit() instead!
ESCAPE_CLEARS_ALLEscape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert)
CTRL_ENTER_FOR_NEW_LINEIn multi-line mode, validate with Enter, add new line with Ctrl+Enter (default is opposite: validate with Ctrl+Enter, add line with Enter).
READ_ONLYRead-only mode
PASSWORDPassword mode, display all characters as '*', disable copy
ALWAYS_OVERWRITEOverwrite mode
AUTO_SELECT_ALLSelect entire text when first taking mouse focus
PARSE_EMPTY_REF_VALinput_float(), input_int(), input_scalar() etc. only: parse empty string as zero value.
DISPLAY_EMPTY_REF_VALinput_float(), input_int(), input_scalar() etc. only: when value is zero, do not display it. Generally used with InputTextFlags.PARSE_EMPTY_REF_VAL.
NO_HORIZONTAL_SCROLLDisable following the cursor horizontally
NO_UNDO_REDODisable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call clear_active_id().
ELIDE_LEFTWhen text doesn't fit, elide left side to ensure right side stays visible. Useful for path/filenames. Single-line only!
CALLBACK_COMPLETIONCallback on pressing TAB (for completion handling)
CALLBACK_HISTORYCallback on pressing Up/Down arrows (for history handling)
CALLBACK_ALWAYSCallback on each iteration. User code may query cursor position, modify text buffer.
CALLBACK_CHAR_FILTERCallback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
CALLBACK_RESIZECallback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
CALLBACK_EDITCallback on any edit. Note that input_text() already returns true on edit + you can always use is_item_edited(). The callback is useful to manipulate the underlying buffer while focus is active.
Key (enum)
KEY_NONE
KEY_NAMED_KEY_BEGIN
KEY_TAB
KEY_LEFT_ARROW
KEY_RIGHT_ARROW
KEY_UP_ARROW
KEY_DOWN_ARROW
KEY_PAGE_UP
KEY_PAGE_DOWN
KEY_HOME
KEY_END
KEY_INSERT
KEY_DELETE
KEY_BACKSPACE
KEY_SPACE
KEY_ENTER
KEY_ESCAPE
KEY_LEFT_CTRL
KEY_LEFT_SHIFT
KEY_LEFT_ALT
KEY_LEFT_SUPER
KEY_RIGHT_CTRL
KEY_RIGHT_SHIFT
KEY_RIGHT_ALT
KEY_RIGHT_SUPER
KEY_MENU
KEY_0
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8
KEY_9
KEY_A
KEY_B
KEY_C
KEY_D
KEY_E
KEY_F
KEY_G
KEY_H
KEY_I
KEY_J
KEY_K
KEY_L
KEY_M
KEY_N
KEY_O
KEY_P
KEY_Q
KEY_R
KEY_S
KEY_T
KEY_U
KEY_V
KEY_W
KEY_X
KEY_Y
KEY_Z
KEY_F1
KEY_F2
KEY_F3
KEY_F4
KEY_F5
KEY_F6
KEY_F7
KEY_F8
KEY_F9
KEY_F10
KEY_F11
KEY_F12
KEY_F13
KEY_F14
KEY_F15
KEY_F16
KEY_F17
KEY_F18
KEY_F19
KEY_F20
KEY_F21
KEY_F22
KEY_F23
KEY_F24
KEY_APOSTROPHE
KEY_COMMA
KEY_MINUS
KEY_PERIOD
KEY_SLASH
KEY_SEMICOLON
KEY_EQUAL
KEY_LEFT_BRACKET
KEY_BACKSLASH
KEY_RIGHT_BRACKET
KEY_GRAVE_ACCENT
KEY_CAPS_LOCK
KEY_SCROLL_LOCK
KEY_NUM_LOCK
KEY_PRINT_SCREEN
KEY_PAUSE
KEY_KEYPAD0
KEY_KEYPAD1
KEY_KEYPAD2
KEY_KEYPAD3
KEY_KEYPAD4
KEY_KEYPAD5
KEY_KEYPAD6
KEY_KEYPAD7
KEY_KEYPAD8
KEY_KEYPAD9
KEY_KEYPAD_DECIMAL
KEY_KEYPAD_DIVIDE
KEY_KEYPAD_MULTIPLY
KEY_KEYPAD_SUBTRACT
KEY_KEYPAD_ADD
KEY_KEYPAD_ENTER
KEY_KEYPAD_EQUAL
KEY_APP_BACK
KEY_APP_FORWARD
KEY_OEM102
KEY_GAMEPAD_START
KEY_GAMEPAD_BACK
KEY_GAMEPAD_FACE_LEFT
KEY_GAMEPAD_FACE_RIGHT
KEY_GAMEPAD_FACE_UP
KEY_GAMEPAD_FACE_DOWN
KEY_GAMEPAD_DPAD_LEFT
KEY_GAMEPAD_DPAD_RIGHT
KEY_GAMEPAD_DPAD_UP
KEY_GAMEPAD_DPAD_DOWN
KEY_GAMEPAD_L1
KEY_GAMEPAD_R1
KEY_GAMEPAD_L2
KEY_GAMEPAD_R2
KEY_GAMEPAD_L3
KEY_GAMEPAD_R3
KEY_GAMEPAD_L_STICK_LEFT
KEY_GAMEPAD_L_STICK_RIGHT
KEY_GAMEPAD_L_STICK_UP
KEY_GAMEPAD_L_STICK_DOWN
KEY_GAMEPAD_R_STICK_LEFT
KEY_GAMEPAD_R_STICK_RIGHT
KEY_GAMEPAD_R_STICK_UP
KEY_GAMEPAD_R_STICK_DOWN
KEY_MOUSE_LEFT
KEY_MOUSE_RIGHT
KEY_MOUSE_MIDDLE
KEY_MOUSE_X1
KEY_MOUSE_X2
KEY_MOUSE_WHEEL_X
KEY_MOUSE_WHEEL_Y
KEY_RESERVED_FOR_MOD_CTRL
KEY_RESERVED_FOR_MOD_SHIFT
KEY_RESERVED_FOR_MOD_ALT
KEY_RESERVED_FOR_MOD_SUPER
KEY_NAMED_KEY_END
MOD_NONE
MOD_CTRL
MOD_SHIFT
MOD_ALT
MOD_SUPER
KEY_NAMED_KEY_COUNT
MouseButton (enum)
LEFT
RIGHT
MIDDLE
COUNT
MouseCursor (enum)
NONE
ARROW
TEXT_INPUTWhen hovering over input_text, etc.
RESIZE_ALL(Unused by Dear ImGui functions)
RESIZE_NSWhen hovering over a horizontal border
RESIZE_EWWhen hovering over a vertical border or a column
RESIZE_NESWWhen hovering over the bottom-left corner of a window
RESIZE_NWSEWhen hovering over the bottom-right corner of a window
HAND(Unused by Dear ImGui functions. Use for e.g. hyperlinks)
WAITWhen waiting for something to process/load.
PROGRESSWhen waiting for something to process/load, but application is still interactive.
NOT_ALLOWEDWhen hovering something with disallowed interaction. Usually a crossed circle.
COUNT
PopupFlags (enum)
NONE
MOUSE_BUTTON_LEFTFor BeginPopupContext*(): open on Left Mouse release. Guaranteed to always be == 0 (same as MouseButton.LEFT)
MOUSE_BUTTON_RIGHTFor BeginPopupContext*(): open on Right Mouse release. Guaranteed to always be == 1 (same as MouseButton.RIGHT)
MOUSE_BUTTON_MIDDLEFor BeginPopupContext*(): open on Middle Mouse release. Guaranteed to always be == 2 (same as MouseButton.MIDDLE)
NO_REOPENFor open_popup*(), BeginPopupContext*(): don't reopen same popup if already open (won't reposition, won't reinitialize navigation)
NO_OPEN_OVER_EXISTING_POPUPFor open_popup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack
NO_OPEN_OVER_ITEMSFor begin_popup_context_window(): don't return true when hovering items, only when hovering empty space
ANY_POPUP_IDFor is_popup_open(): ignore the ImGuiID parameter and test for any popup.
ANY_POPUP_LEVELFor is_popup_open(): search/test at any level of the popup stack (default test in the current level)
ANY_POPUP
SelectableFlags (enum)
NONE
NO_AUTO_CLOSE_POPUPSClicking this doesn't close parent popup window (overrides ItemFlags.AUTO_CLOSE_POPUPS)
SPAN_ALL_COLUMNSFrame will span all columns of its container table (text will still fit in current column)
ALLOW_DOUBLE_CLICKGenerate press events on double clicks too
DISABLEDCannot be selected, display grayed out text
ALLOW_OVERLAP(WIP) Hit testing to allow subsequent widgets to overlap this one
HIGHLIGHTMake the item be displayed as if it is hovered
SliderFlags (enum)
NONE
LOGARITHMICMake the widget logarithmic (linear otherwise). Consider using SliderFlags.NO_ROUND_TO_FORMAT with this if using a format-string with small amount of digits.
NO_ROUND_TO_FORMATDisable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits).
NO_INPUTDisable CTRL+Click or Enter key allowing to input text directly into the widget.
WRAP_AROUNDEnable wrapping around from max to min and from min to max. Only supported by DragXXX() functions for now.
CLAMP_ON_INPUTClamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
CLAMP_ZERO_RANGEClamp even if min==max==0.0f. Otherwise due to legacy reason DragXXX functions don't clamp with those values. When your clamping limits are dynamic you almost always want to use it.
NO_SPEED_TWEAKSDisable keyboard modifiers altering tweak speed. Useful if you want to alter tweak speed yourself based on your own logic.
ALWAYS_CLAMP
StyleVar (enum)
ALPHAFloat Alpha
DISABLED_ALPHAFloat DisabledAlpha
WINDOW_PADDINGImVec2 WindowPadding
WINDOW_ROUNDINGFloat WindowRounding
WINDOW_BORDER_SIZEFloat WindowBorderSize
WINDOW_MIN_SIZEImVec2 WindowMinSize
WINDOW_TITLE_ALIGNImVec2 WindowTitleAlign
CHILD_ROUNDINGFloat ChildRounding
CHILD_BORDER_SIZEFloat ChildBorderSize
POPUP_ROUNDINGFloat PopupRounding
POPUP_BORDER_SIZEFloat PopupBorderSize
FRAME_PADDINGImVec2 FramePadding
FRAME_ROUNDINGFloat FrameRounding
FRAME_BORDER_SIZEFloat FrameBorderSize
ITEM_SPACINGImVec2 ItemSpacing
ITEM_INNER_SPACINGImVec2 ItemInnerSpacing
INDENT_SPACINGFloat IndentSpacing
CELL_PADDINGImVec2 CellPadding
SCROLLBAR_SIZEFloat ScrollbarSize
SCROLLBAR_ROUNDINGFloat ScrollbarRounding
GRAB_MIN_SIZEFloat GrabMinSize
GRAB_ROUNDINGFloat GrabRounding
IMAGE_BORDER_SIZEFloat ImageBorderSize
TAB_ROUNDINGFloat TabRounding
TAB_BORDER_SIZEFloat TabBorderSize
TAB_BAR_BORDER_SIZEFloat TabBarBorderSize
TAB_BAR_OVERLINE_SIZEFloat TabBarOverlineSize
TABLE_ANGLED_HEADERS_ANGLEFloat TableAngledHeadersAngle
TABLE_ANGLED_HEADERS_TEXT_ALIGNImVec2 TableAngledHeadersTextAlign
BUTTON_TEXT_ALIGNImVec2 ButtonTextAlign
SELECTABLE_TEXT_ALIGNImVec2 SelectableTextAlign
SEPARATOR_TEXT_BORDER_SIZEFloat SeparatorTextBorderSize
SEPARATOR_TEXT_ALIGNImVec2 SeparatorTextAlign
SEPARATOR_TEXT_PADDINGImVec2 SeparatorTextPadding
COUNT
TabBarFlags (enum)
NONE
REORDERABLEAllow manually dragging tabs to re-order them + New tabs are appended at the end of list
AUTO_SELECT_NEW_TABSAutomatically select new tabs when they appear
TAB_LIST_POPUP_BUTTONDisable buttons to open the tab list popup
NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTONDisable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You may handle this behavior manually on user's side with if (is_item_hovered() && is_mouse_clicked(2)) *p_open = false.
NO_TAB_LIST_SCROLLING_BUTTONSDisable scrolling buttons (apply when fitting policy is TabBarFlags.FITTING_POLICY_SCROLL)
NO_TOOLTIPDisable tooltips when hovering a tab
DRAW_SELECTED_OVERLINEDraw selected overline markers over selected tab
FITTING_POLICY_RESIZE_DOWNResize tabs when they don't fit
FITTING_POLICY_SCROLLAdd scroll buttons when tabs don't fit
TabItemFlags (enum)
NONE
UNSAVED_DOCUMENTDisplay a dot next to the title + set TabItemFlags.NO_ASSUMED_CLOSURE.
SET_SELECTEDTrigger flag to programmatically make the tab selected when calling begin_tab_item()
NO_CLOSE_WITH_MIDDLE_MOUSE_BUTTONDisable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You may handle this behavior manually on user's side with if (is_item_hovered() && is_mouse_clicked(2)) *p_open = false.
NO_PUSH_IDDon't call push_id()/pop_id() on begin_tab_item()/end_tab_item()
NO_TOOLTIPDisable tooltip for the given tab
NO_REORDERDisable reordering this tab or having another tab cross over this tab
LEADINGEnforce the tab position to the left of the tab bar (after the tab list popup button)
TRAILINGEnforce the tab position to the right of the tab bar (before the scrolling buttons)
NO_ASSUMED_CLOSURETab is selected when trying to close + closure is not immediately assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
TableBgTarget (enum)
NONE
ROW_BG0Set row background color 0 (generally used for background, automatically set when TableFlags.ROW_BG is used)
ROW_BG1Set row background color 1 (generally used for selection marking)
CELL_BGSet cell background color (top-most color)
TableColumnFlags (enum)
NONE
DISABLEDOverriding/master disable flag: hide column, won't show in context menu (unlike calling table_set_column_enabled() which manipulates the user accessible state)
DEFAULT_HIDEDefault as a hidden/disabled column.
DEFAULT_SORTDefault as a sorting column.
WIDTH_STRETCHColumn will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp).
WIDTH_FIXEDColumn will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).
NO_RESIZEDisable manual resizing.
NO_REORDERDisable manual reordering this column, this will also prevent other columns from crossing over this column.
NO_HIDEDisable ability to hide/disable this column.
NO_CLIPDisable clipping for this column (all NoClip columns will render in a same draw command).
NO_SORTDisable ability to sort on this field (even if TableFlags.SORTABLE is set on the table).
NO_SORT_ASCENDINGDisable ability to sort in the ascending direction.
NO_SORT_DESCENDINGDisable ability to sort in the descending direction.
NO_HEADER_LABELtable_headers_row() will submit an empty label for this column. Convenient for some small columns. Name will still appear in context menu or in angled headers. You may append into this cell by calling table_set_column_index() right after the table_headers_row() call.
NO_HEADER_WIDTHDisable header text width contribution to automatic column width.
PREFER_SORT_ASCENDINGMake the initial sort direction Ascending when first sorting on this column (default).
PREFER_SORT_DESCENDINGMake the initial sort direction Descending when first sorting on this column.
INDENT_ENABLEUse current indent value when entering cell (default for column 0).
INDENT_DISABLEIgnore current indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored.
ANGLED_HEADERtable_headers_row() will submit an angled header row for this column. Note this will add an extra row.
IS_ENABLEDStatus: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags.
IS_VISIBLEStatus: is visible == is enabled AND not clipped by scrolling.
IS_SORTEDStatus: is currently part of the sort specs
IS_HOVEREDStatus: is hovered by mouse
TableFlags (enum)
NONE
RESIZABLEEnable resizing columns.
REORDERABLEEnable reordering columns in header row (need calling table_setup_column() + table_headers_row() to display headers)
HIDEABLEEnable hiding/disabling columns in context menu.
SORTABLEEnable sorting. Call table_get_sort_specs() to obtain sort specs. Also see TableFlags.SORT_MULTI and TableFlags.SORT_TRISTATE.
NO_SAVED_SETTINGSDisable persisting columns order, width and sort settings in the .ini file.
CONTEXT_MENU_IN_BODYRight-click on columns body/contents will display table context menu. By default it is available in table_headers_row().
ROW_BGSet each RowBg color with Col.TABLE_ROW_BG or Col.TABLE_ROW_BG_ALT (equivalent of calling table_set_bg_color with ImGuiTableBgFlags_RowBg0 on each row manually)
BORDERS_INNER_HDraw horizontal borders between rows.
BORDERS_OUTER_HDraw horizontal borders at the top and bottom.
BORDERS_INNER_VDraw vertical borders between columns.
BORDERS_OUTER_VDraw vertical borders on the left and right sides.
BORDERS_HDraw horizontal borders.
BORDERS_VDraw vertical borders.
BORDERS_INNERDraw inner borders.
BORDERS_OUTERDraw outer borders.
BORDERSDraw all borders.
NO_BORDERS_IN_BODY[ALPHA] Disable vertical borders in columns Body (borders will always appear in Headers). -> May move to style
NO_BORDERS_IN_BODY_UNTIL_RESIZE[ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers). -> May move to style
SIZING_FIXED_FITcolumns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
SIZING_FIXED_SAMEcolumns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable TableFlags.NO_KEEP_COLUMNS_VISIBLE.
SIZING_STRETCH_PROPcolumns default to _WidthStretch with default weights proportional to each columns contents widths.
SIZING_STRETCH_SAMEcolumns default to _WidthStretch with default weights all equal, unless overridden by table_setup_column().
NO_HOST_EXTEND_XMake outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used.
NO_HOST_EXTEND_YMake outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible.
NO_KEEP_COLUMNS_VISIBLEDisable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable.
PRECISE_WIDTHSDisable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.
NO_CLIPDisable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with table_setup_scroll_freeze().
PAD_OUTER_XDefault if BordersOuterV is on. Enable outermost padding. Generally desirable if you have headers.
NO_PAD_OUTER_XDefault if BordersOuterV is off. Disable outermost padding.
NO_PAD_INNER_XDisable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).
SCROLL_XEnable horizontal scrolling. Require 'outer_size' parameter of begin_table() to specify the container size. Changes default sizing policy. Because this creates a child window, ScrollY is currently generally recommended when using ScrollX.
SCROLL_YEnable vertical scrolling. Require 'outer_size' parameter of begin_table() to specify the container size.
SORT_MULTIHold shift when clicking headers to sort on multiple column. table_get_sort_specs() may return specs where (SpecsCount > 1).
SORT_TRISTATEAllow no sorting, disable default sorting. table_get_sort_specs() may return specs where (SpecsCount == 0).
HIGHLIGHT_HOVERED_COLUMNHighlight column headers when hovered (may evolve into a fuller highlight)
TableRowFlags (enum)
NONE
HEADERSIdentify header row (set default background color + width of its contents accounted differently for auto column width)
TreeNodeFlags (enum)
NONE
SELECTEDDraw as selected
FRAMEDDraw frame with background (e.g. for collapsing_header)
ALLOW_OVERLAPHit testing to allow subsequent widgets to overlap this one
NO_TREE_PUSH_ON_OPENDon't do a tree_push() when open (e.g. for collapsing_header) = no extra indent nor pushing on ID stack
NO_AUTO_OPEN_ON_LOGDon't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes)
DEFAULT_OPENDefault node to be open
OPEN_ON_DOUBLE_CLICKOpen on double-click instead of simple click (default for multi-select unless any _OpenOnXXX behavior is set explicitly). Both behaviors may be combined.
OPEN_ON_ARROWOpen when clicking on the arrow part (default for multi-select unless any _OpenOnXXX behavior is set explicitly). Both behaviors may be combined.
LEAFNo collapsing, no arrow (use as a convenience for leaf nodes).
BULLETDisplay a bullet instead of arrow. IMPORTANT: node can still be marked open/close if you don't set the _Leaf flag!
FRAME_PADDINGUse FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling align_text_to_frame_padding() before the node.
SPAN_AVAIL_WIDTHExtend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode.
SPAN_FULL_WIDTHExtend hit box to the left-most and right-most edges (cover the indent area).
SPAN_LABEL_WIDTHNarrow hit box + narrow hovering highlight, will only cover the label text.
SPAN_ALL_COLUMNSFrame will span all columns of its container table (label will still fit in current column)
LABEL_SPAN_ALL_COLUMNSLabel will span all columns of its container table
NAV_LEFT_JUMPS_BACK_HERE(WIP) Nav: left direction may move to this tree_node() from any of its child (items submitted between tree_node and tree_pop)
COLLAPSING_HEADER
WindowFlags (enum)
NONE
NO_TITLE_BARDisable title-bar
NO_RESIZEDisable user resizing with the lower-right grip
NO_MOVEDisable user moving the window
NO_SCROLLBARDisable scrollbars (window can still scroll with mouse or programmatically)
NO_SCROLL_WITH_MOUSEDisable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
NO_COLLAPSEDisable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node).
ALWAYS_AUTO_RESIZEResize every window to its content every frame
NO_BACKGROUNDDisable drawing background color (WindowBg, etc.) and outside border. Similar as using set_next_window_bg_alpha(0.0).
NO_SAVED_SETTINGSNever load/save settings in .ini file
NO_MOUSE_INPUTSDisable catching mouse, hovering test with pass through.
MENU_BARHas a menu-bar
HORIZONTAL_SCROLLBARAllow horizontal scrollbar to appear (off by default). You may use set_next_window_content_size((width,0.0)); prior to calling begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
NO_FOCUS_ON_APPEARINGDisable taking focus when transitioning from hidden to visible state
NO_BRING_TO_FRONT_ON_FOCUSDisable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus)
ALWAYS_VERTICAL_SCROLLBARAlways show vertical scrollbar (even if ContentSize.y < Size.y)
ALWAYS_HORIZONTAL_SCROLLBARAlways show horizontal scrollbar (even if ContentSize.x < Size.x)
NO_NAV_INPUTSNo keyboard/gamepad navigation within the window
NO_NAV_FOCUSNo focusing toward this window with keyboard/gamepad navigation (e.g. skipped by CTRL+TAB)
UNSAVED_DOCUMENTDisplay a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
NO_NAV
NO_DECORATION
NO_INPUTS
CHILD_WINDOWDon't use! For internal use by begin_child()
TOOLTIPDon't use! For internal use by begin_tooltip()
POPUPDon't use! For internal use by begin_popup()
MODALDon't use! For internal use by begin_popup_modal()
CHILD_MENUDon't use! For internal use by begin_menu()