Skip to content

imgui_repository

Classes:

Default dataclass

Default(*args, **kwargs)

Methods:

__call__

__call__(*args, **kwargs)

__getattr__

__getattr__(item)

ImGuiRendererRepository

ImGuiRendererRepository(window: int)

Bases: Protocol

Methods:

process_inputs

process_inputs()

render

render(data: Any)

Imgui

Bases: Protocol

A helper class to interact with the ImGui library

Methods:

accept_drag_drop_payload

accept_drag_drop_payload(type: str, flags: int) -> Any

Accept a drag and drop payload

Parameters:

  • type

    (str) –

    The type of the payload

  • flags

    (int) –

    The flags of the payload

Returns:

  • Any ( Any ) –

    The payload data

align_text_to_frame_padding

align_text_to_frame_padding() -> None

Align text to the frame padding

arrow_button

arrow_button(label: str, direction: int) -> bool

Create an arrow button

Parameters:

  • label

    (str) –

    The label of the button

  • direction

    (int) –

    The direction of the arrow

Returns:

  • bool ( bool ) –

    True if the button was clicked

begin

begin(name: str, open: Optional[bool] = None, flags: int = 0) -> bool

Begin a new window

Parameters:

  • name

    (str) –

    The name of the window

  • open

    (Optional[bool], default: None ) –

    Whether the window is open (default: None)

  • flags

    (int, default: 0 ) –

    The flags of the window (default: 0)

Returns:

  • bool ( bool ) –

    True if the window is open

begin_child

begin_child(id: str, width: float, height: float, border: bool = False, flags: int = 0) -> bool

Begin a new child window

Parameters:

  • id

    (str) –

    The id of the child window

  • width

    (float) –

    The width of the child window

  • height

    (float) –

    The height of the child window

  • border

    (bool, default: False ) –

    Whether the child window has a border (default: False)

  • flags

    (int, default: 0 ) –

    The flags of the child window (default: 0)

Returns:

  • bool ( bool ) –

    True if the child window is open

begin_combo

begin_combo(label: str, preview_value: str, flags: int = 0) -> bool

Begin a new combo box

Parameters:

  • label

    (str) –

    The label of the combo box

  • preview_value

    (str) –

    The preview value of the combo box

  • flags

    (int, default: 0 ) –

    The flags of the combo box (default: 0)

Returns:

  • bool ( bool ) –

    True if the combo box is open

begin_drag_drop_source

begin_drag_drop_source(flags: int = 0) -> bool

Begin a new drag and drop source

Parameters:

  • flags

    (int, default: 0 ) –

    The flags of the drag and drop source (default: 0)

Returns:

  • bool ( bool ) –

    True if the drag and drop source is active

begin_main_menu_bar

begin_main_menu_bar() -> bool

Begin a new main menu bar

Returns:

  • bool ( bool ) –

    True if the main menu bar is open

begin_menu

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

Begin a new menu

Parameters:

  • label

    (str) –

    The label of the menu

  • enabled

    (bool, default: True ) –

    Whether the menu is enabled (default: True)

Returns:

  • bool ( bool ) –

    True if the menu is open

begin_popup

begin_popup(id: str) -> bool

Begin a new popup

Parameters:

  • id

    (str) –

    The id of the popup

Returns:

  • bool ( bool ) –

    True if the popup is open

begin_tab_bar

begin_tab_bar(id: str, flags: int = 0) -> bool

Begin a new tab bar

Parameters:

  • id

    (str) –

    The id of the tab bar

  • flags

    (int, default: 0 ) –

    The flags of the tab bar (default: 0)

Returns:

  • bool ( bool ) –

    True if the tab bar is open

begin_tab_item

begin_tab_item(label: str, open: Optional[bool] = None, flags: int = 0) -> Tuple[bool, bool]

Begin a new tab item

Parameters:

  • label

    (str) –

    The label of the tab item

  • open

    (Optional[bool], default: None ) –

    Whether the tab item is open (default: None)

  • flags

    (int, default: 0 ) –

    The flags of the tab item (default: 0)

Returns:

  • Tuple[bool, bool]

    Tuple[bool, bool]: A tuple containing (is_open, is_just_opened)

button

button(label: str, width: float = 0.0, height: float = 0.0) -> bool

Create a button

Parameters:

  • label

    (str) –

    The label of the button

  • width

    (float, default: 0.0 ) –

    The width of the button (default: 0.0)

  • height

    (float, default: 0.0 ) –

    The height of the button (default: 0.0)

Returns:

  • bool ( bool ) –

    True if the button was clicked

checkbox

checkbox(label: str, state: bool) -> Tuple[bool, bool]

Create a checkbox

Parameters:

  • label

    (str) –

    The label of the checkbox

  • state

    (bool) –

    The state of the checkbox

Returns:

  • Tuple[bool, bool]

    Tuple[bool, bool]: A tuple containing (was_clicked, new_state)

create_context

create_context() -> None

Create a new ImGui Context

end

end() -> None

End the current window

end_child

end_child() -> None

End the current child window

end_frame

end_frame() -> None

End the current ImGui frame

end_main_menu_bar

end_main_menu_bar() -> None

End the current main menu bar

end_menu

end_menu() -> None

End the current menu

end_popup

end_popup() -> None

End the current popup

end_tab_bar

end_tab_bar() -> None

End the current tab bar

end_tab_item

end_tab_item() -> None

End the current tab item

get_content_region_available

get_content_region_available() -> Tuple[float, float]

Get the content region available

Returns:

  • Tuple[float, float]

    Tuple[float, float]: The available width and height

get_cursor_screen_pos

get_cursor_screen_pos() -> Tuple[float, float]

Get the cursor screen position

Returns:

  • Tuple[float, float]

    Tuple[float, float]: The x and y coordinates of the cursor

get_draw_data

get_draw_data() -> Any

Get the draw data

get_io

get_io() -> Any

Get the ImGui IO object

get_window_draw_list

get_window_draw_list() -> Any

Get the window draw list

Returns:

  • Any ( Any ) –

    The draw list

image

image(texture_id: int, size: Tuple[int, int], uv0: Tuple[float, float] = (0.0, 0.0), uv1: Tuple[float, float] = (1.0, 1.0), tint_col: Optional[Tuple[float, float, float, float]] = None, border_col: Optional[Tuple[float, float, float, float]] = None) -> None

Create an image

Parameters:

input_float

input_float(label: str, value: float, step: float = 0.0, step_fast: float = 0.0, format: str = '%.3f', flags: int = 0) -> Tuple[bool, float]

Create a float input field

Parameters:

  • label

    (str) –

    The label of the input field

  • value

    (float) –

    The value of the input field

  • step

    (float, default: 0.0 ) –

    The step of the input field (default: 0.0)

  • step_fast

    (float, default: 0.0 ) –

    The fast step of the input field (default: 0.0)

  • format

    (str, default: '%.3f' ) –

    The format of the input field (default: "%.3f")

  • flags

    (int, default: 0 ) –

    The flags of the input field (default: 0)

Returns:

  • Tuple[bool, float]

    Tuple[bool, float]: A tuple containing (was_edited, new_value)

input_text

input_text(label: str, value: str, buffer_length: int, flags: int = 0) -> Tuple[bool, str]

Create an input text field

Parameters:

  • label

    (str) –

    The label of the input field

  • value

    (str) –

    The value of the input field

  • buffer_length

    (int) –

    The length of the buffer

  • flags

    (int, default: 0 ) –

    The flags of the input field (default: 0)

Returns:

  • Tuple[bool, str]

    Tuple[bool, str]: A tuple containing (was_edited, new_value)

input_text_multiline

input_text_multiline(label: str, value: str, buffer_length: int, width: float = 0.0, height: float = 0.0, flags: int = 0, callback: Optional[Any] = None) -> Tuple[bool, str]

Create a multiline input text field

Parameters:

  • label

    (str) –

    The label of the input field

  • value

    (str) –

    The value of the input field

  • buffer_length

    (int) –

    The length of the buffer

  • width

    (float, default: 0.0 ) –

    The width of the input field (default: 0.0)

  • height

    (float, default: 0.0 ) –

    The height of the input field (default: 0.0)

  • flags

    (int, default: 0 ) –

    The flags of the input field (default: 0)

  • callback

    (Optional[Any], default: None ) –

    The callback of the input field (default: None)

Returns:

  • Tuple[bool, str]

    Tuple[bool, str]: A tuple containing (was_edited, new_value)

menu_item

menu_item(label: str, shortcut: Optional[str] = None, selected: bool = False, enabled: bool = True) -> Tuple[bool, bool]

Create a menu item

Parameters:

  • label

    (str) –

    The label of the menu item

  • shortcut

    (Optional[str], default: None ) –

    The shortcut of the menu item (default: None)

  • selected

    (bool, default: False ) –

    Whether the menu item is selected (default: False)

  • enabled

    (bool, default: True ) –

    Whether the menu item is enabled (default: True)

Returns:

  • Tuple[bool, bool]

    Tuple[bool, bool]: A tuple containing (was_clicked, is_selected)

new_frame

new_frame() -> None

Start a new ImGui frame

open_popup

open_popup(id: str) -> None

Open a popup

Parameters:

  • id

    (str) –

    The id of the popup

radio_button

radio_button(label: str, active: bool) -> bool

Create a radio button

Parameters:

  • label

    (str) –

    The label of the radio button

  • active

    (bool) –

    Whether the radio button is active

Returns:

  • bool ( bool ) –

    True if the radio button was clicked

render

render() -> None

Render the ImGui frame

same_line

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

Move the cursor to the same line

Parameters:

  • offset_from_start_x

    (float, default: 0.0 ) –

    The offset from the start x (default: 0.0)

  • spacing

    (float, default: -1.0 ) –

    The spacing (default: -1.0)

set_next_window_bg_alpha

set_next_window_bg_alpha(alpha: float) -> None

Set the background alpha of the next window

Parameters:

  • alpha

    (float) –

    The alpha value of the background

set_next_window_collapsed

set_next_window_collapsed(collapsed: bool, cond: int = 0) -> None

Set the collapsed state of the next window

Parameters:

  • collapsed

    (bool) –

    Whether the window is collapsed

  • cond

    (int, default: 0 ) –

    The condition to set the collapsed state (default: 0)

set_next_window_content_size

set_next_window_content_size(width: float, height: float) -> None

Set the content size of the next window

Parameters:

  • width

    (float) –

    The width of the content

  • height

    (float) –

    The height of the content

set_next_window_focus

set_next_window_focus() -> None

Set the focus of the next window

set_next_window_position

set_next_window_position(x: float, y: float, cond: int = 0) -> None

Set the position of the next window

Parameters:

  • x

    (float) –

    The x position of the window

  • y

    (float) –

    The y position of the window

  • cond

    (int, default: 0 ) –

    The condition to set the position (default: 0)

set_next_window_size

set_next_window_size(width: float, height: float, cond: int = 0) -> None

Set the size of the next window

Parameters:

  • width

    (float) –

    The width of the window

  • height

    (float) –

    The height of the window

  • cond

    (int, default: 0 ) –

    The condition to set the size (default: 0)

set_next_window_size_constraints

set_next_window_size_constraints(min_width: float, min_height: float, max_width: float, max_height: float, cond: int = 0) -> None

Set the size constraints of the next window

Parameters:

  • min_width

    (float) –

    The minimum width of the window

  • min_height

    (float) –

    The minimum height of the window

  • max_width

    (float) –

    The maximum width of the window

  • max_height

    (float) –

    The maximum height of the window

  • cond

    (int, default: 0 ) –

    The condition to set the constraints (default: 0)

shutdown

shutdown() -> None

Shutdown the ImGui context

slider_float

slider_float(label: str, value: float, min_value: float, max_value: float, format: str = '%.3f', power: float = 1.0, flags: int = 0) -> Tuple[bool, float]

Create a float slider

Parameters:

  • label

    (str) –

    The label of the slider

  • value

    (float) –

    The value of the slider

  • min_value

    (float) –

    The minimum value of the slider

  • max_value

    (float) –

    The maximum value of the slider

  • format

    (str, default: '%.3f' ) –

    The format of the slider (default: "%.3f")

  • power

    (float, default: 1.0 ) –

    The power of the slider (default: 1.0)

  • flags

    (int, default: 0 ) –

    The flags of the slider (default: 0)

Returns:

  • Tuple[bool, float]

    Tuple[bool, float]: A tuple containing (was_edited, new_value)

slider_int

slider_int(label: str, value: int, min_value: int, max_value: int, format: str = '%d', flags: int = 0) -> Tuple[bool, int]

Create an integer slider

Parameters:

  • label

    (str) –

    The label of the slider

  • value

    (int) –

    The value of the slider

  • min_value

    (int) –

    The minimum value of the slider

  • max_value

    (int) –

    The maximum value of the slider

  • format

    (str, default: '%d' ) –

    The format of the slider (default: "%d")

  • flags

    (int, default: 0 ) –

    The flags of the slider (default: 0)

Returns:

  • Tuple[bool, int]

    Tuple[bool, int]: A tuple containing (was_edited, new_value)

text

text(text: str) -> None

Print text

Parameters:

  • text

    (str) –

    The text to print