DearPyGui
DearPyGui copied to clipboard
Fix not showing "picker_mode" in demo
name: Fix not showing "picker_mode" in demo about: Fixing demo title: Fix not showing "picker_mode" in demo
Description:
In the "Color Picker & Edit" section of the demo the option "picker_mode" wasn't shown, now it's visible. This has been done creating a dummy group just to create an ID where the _add_config_options
down in the code can "attach" to.
Actually this opens the question on why this happens. The parameter before
should work differently.
Should I open an issue about that?
Concerning Areas: None
Did you mean the option "picker_mode", not "color_picker"?
As to why this happens:
- Without the fix,
_before_id
points to the first child of a horizontal group. - Then
_add_config_options
inserts a table into that group, and puts all those checkboxes into the table. The table is inserted before the text label "picker_mode:" and becomes the first child of that group. - The table stretches to fill the window width. Since the group is horizontal, the rest of the group get rendered on the right side of the table, that is, outside of the window client area.
If horizontal scrollbar on the window was enabled, we'd see the scrollbar and would be able to scroll to the right and see the "picker_mode" option.
Another approach to fix it could be to insert the table before that horizontal group:
with dpg.group(horizontal=True) as _before_id:
dpg.add_text("picker_mode:")
This doesn't require an extra empty group.
Oh okay! Really thank you @v-ein for the explanation! Also I think that your last piece of code is definetely a more elegant way of handle this problem, so I refactored it!