taichi.ui.imgui

Module Contents

Classes

Gui

class taichi.ui.imgui.Gui(gui)
sub_window(self, name, x, y, width, height)

Creating a context manager for subwindow

Note

All args of this method should align with begin.

Parameters
  • x (float) – The x-coordinate (between 0 and 1) of the top-left corner of the subwindow, relative to the full window.

  • y (float) – The y-coordinate (between 0 and 1) of the top-left corner of the subwindow, relative to the full window.

  • width (float) – The width of the subwindow relative to the full window.

  • height (float) – The height of the subwindow relative to the full window.

Usage:

>>> with gui.sub_window(name, x, y, width, height) as g:
>>>     g.text("Hello, World!")
begin(self, name, x, y, width, height)

Creates a subwindow that holds imgui widgets.

All widget function calls (e.g. text, button) after the begin and before the next end will describe the widgets within this subwindow.

Parameters
  • x (float) – The x-coordinate (between 0 and 1) of the top-left corner of the subwindow, relative to the full window.

  • y (float) – The y-coordinate (between 0 and 1) of the top-left corner of the subwindow, relative to the full window.

  • width (float) – The width of the subwindow relative to the full window.

  • height (float) – The height of the subwindow relative to the full window.

end(self)

End the description of the current subwindow.

text(self, text)

Declares a line of text.

checkbox(self, text, old_value)

Declares a checkbox, and returns whether or not it has been checked.

Parameters
  • text (str) – a line of text to be shown next to the checkbox

  • old_value (bool) – whether the checkbox is currently checked

slider_float(self, text, old_value, minimum, maximum)

Declares a slider, and returns its newest value.

Parameters
  • text (str) – a line of text to be shown next to the slider

  • old_value (float) – the current value of the slider.

  • minimum (float) – the minimum value of the slider.

  • maximum (float) – the maximum value of the slider.

color_edit_3(self, text, old_value)

Declares a color edit palate.

Parameters
  • text (str) – a line of text to be shown next to the palate

  • old_value (Tuple[float]) – the current value of the color, this should be a tuple of floats in [0,1] that indicates RGB values.

button(self, text)

Declares a button, and returns whether or not it had just been clicked.

Parameters

text (str) – a line of text to be shown next to the button