taichi.ui.imgui
#
- class taichi.ui.imgui.Gui(gui)#
For declaring IMGUI components in a
taichi.ui.Window
created by the GGUI system.- Parameters:
gui – reference to a PyGui.
- 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.
- 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.
- 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.
- 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.
- end(self)#
End the description of the current subwindow.
- 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.
- slider_int(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 (int) – the current value of the slider.
minimum (int) – the minimum value of the slider.
maximum (int) – the maximum value of the slider.
- Returns:
the updated value of the slider.
- Return type:
int
- 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.
Example:
>>> with gui.sub_window(name, x, y, width, height) as g:
>>> g.text("Hello, World!")
- text(self, text, color=None)#
Declares a line of text.