DearPyGui
DearPyGui copied to clipboard
_add_config_options() can ignore some checkboxes
The _add_config_options() function in the demo truncates options at the end if the number of names isn't evenly divisible by number of columns:
https://github.com/hoffstadt/DearPyGui/blob/3ce32db5bdaa7c1b9f202ffdf7fe0e2505b7810f/dearpygui/demo.py#L38
An example can be found in the "Color Picker & Edit" -> "Color Picker" checkbox area where there are ten items divided into three columns and the "alpha_bar" checkbox isn't showing.
Another example is in "Plots" -> "Subplots" with five names over two columns and "link_all_y" missing from the grid of checkboxes.
I'm not sure about the code policies for this project, but this change to the loop at the end of the function makes it work:
for i in range(int(ceil(len(names) / columns))):
with dpg.table_row():
for j in range(columns):
index = i * columns + j
if index >= len(names):
break
dpg.add_checkbox(
label=names[index],
callback=_config,
user_data=item,
default_value=dpg.get_item_configuration(item)[names[index]],
)
I guess a try/except IndexError
block might be more pythonic