Skip to content

Commit

Permalink
update documentation for checkboxes (closes #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Jaworski committed Nov 2, 2018
1 parent 1e2adee commit f964817
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/source/visual_examples/imgui.core.checkbox_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions imgui/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3230,16 +3230,27 @@ def checkbox(str label, cimgui.bool state):
:auto_layout:
:width: 400
# note: these should be initialized outside of the main interaction
# loop
checkbox1_enabled = True
checkbox2_enabled = False
imgui.new_frame()
imgui.begin("Example: checkboxes")
c1_output = imgui.checkbox("Checkbox 1", True)
c2_output = imgui.checkbox("Checkbox 2", False)
# note: first element of return two-tuple notifies if there was a click
# event in currently processed frame and second element is actual
# checkbox state.
_, checkbox1_enabled = imgui.checkbox("Checkbox 1", checkbox1_enabled)
_, checkbox2_enabled = imgui.checkbox("Checkbox 2", checkbox2_enabled)
imgui.text("Checkbox 1 return value: {}".format(c1_output))
imgui.text("Checkbox 2 return value: {}".format(c2_output))
imgui.text("Checkbox 1 state value: {}".format(checkbox1_enabled))
imgui.text("Checkbox 2 state value: {}".format(checkbox2_enabled))
imgui.end()
Args:
label (str): text label for checkbox widget.
state (bool): current (desired) state of the checkbox. If it has to
Expand Down

0 comments on commit f964817

Please sign in to comment.