imgui.extra module

This module provides extra utilities that are not part of core ImGui C++ API but are useful in Python application.

imgui.extra.text_ansi()

_ansifeed_text_ansi(str text) Add ANSI-escape-formatted text to current widget stack.

Similar to imgui.text, but with ANSI parsing. imgui.text documentation below:

Example:

imgui.begin("Example: simple text")
imgui.extra.text_ansi("Default  colored  default")
imgui.end()

Outputs:

../_images/simple_text_widget.png
Args:

text (str): text to display.

Wraps API:

Text(const char* fmt, ...)
imgui.extra.text_ansi_colored()

_ansifeed_text_ansi_colored(str text, float r, float g, float b, float a=1.) Add pre-colored ANSI-escape-formatted text to current widget stack.

Similar to imgui.text_colored, but with ANSI parsing. imgui.text_colored documentation below:

It is a shortcut for:

imgui.push_style_color(imgui.COLOR_TEXT, r, g, b, a)
imgui.extra.text_ansi(text)
imgui.pop_style_color()

Example:

imgui.begin("Example: colored text")
imgui.text_ansi_colored("Default  colored  default", 1, 0, 0)
imgui.end()

Outputs:

../_images/colored_text_widget.png
Args:

text (str): text to display. r (float): red color intensity. g (float): green color intensity. b (float): blue color instensity. a (float): alpha intensity.

Wraps API:

TextColored(const ImVec4& col, const char* fmt, ...)
imgui.extra.font(font)

_py_font(_Font font) Use specified font in given context.

Example:

io = imgui.get_io()

new_font = io.fonts.add_font_from_file_ttf("DroidSans.ttf", 20)
impl.refresh_font_texture()

# later in frame code

imgui.begin("Default Window")

imgui.text("Text displayed using default font")
with imgui.font(new_font):
    imgui.text("Text displayed using custom font")

imgui.end()

Outputs:

../_images/1eee3be367ecdb3ce9868aa97e5adc40c1bfb00f.png
Args:

font (_Font): font object retrieved from add_font_from_file_ttf.

imgui.extra.styled(variable, value)

_py_styled(ImGuiStyleVar variable, value)

imgui.extra.istyled(*variables_and_values)

istyled

imgui.extra.colored(variable, r, g, b, a=1.0)

_py_colored(ImGuiCol variable, float r, float g, float b, float a=1.)

imgui.extra.vertex_buffer_vertex_pos_offset()

_py_vertex_buffer_vertex_pos_offset()

imgui.extra.vertex_buffer_vertex_uv_offset()

_py_vertex_buffer_vertex_uv_offset()

imgui.extra.vertex_buffer_vertex_col_offset()

_py_vertex_buffer_vertex_col_offset()

imgui.extra.vertex_buffer_vertex_size()

_py_vertex_buffer_vertex_size()

imgui.extra.index_buffer_index_size()

_py_index_buffer_index_size()