potocpav / python-concur

Concur UI Framework for Python
MIT License
48 stars 2 forks source link

v_slider_float via c.interactive_elem -> Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") at imgui-cpp/imgui_widgets.cpp:2754 #24

Closed sla-te closed 3 years ago

sla-te commented 3 years ago

Im trying to create a v_slider_float I get: imgui.core.ImGuiError: ImGui assertion error ((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.") at imgui-cpp/imgui_widgets.cpp:2754

I call it via:

c.interactive_elem(imgui.v_slider_float,
                   name="SLIDER_FLOAT",
                   width=20.0, height=100, value=1.0,
                   min_value=1, max_value=10,
                   format="%0.3f",
                   tag='my_tag'),

Maybe related to: https://github.com/ocornut/imgui/issues/3361

potocpav commented 3 years ago

Thanks for the report, and the upstream cause.

I fixed the issue by adapting PyImGui to the changes. It should be fixed in the 1.3.7 release.

You can apply the fix by upgrading python-concur to v0.10.0 - which contains some other changes, or just by upgrading concur_imgui to 1.3.7.

potocpav commented 3 years ago

Here is the commit with the fix https://github.com/potocpav/pyimgui/commit/96c60050f5c69866499e44a9792717dac684d6f0

sla-te commented 3 years ago

Tested, works indeed. How do we either change the position or hide the value inside the slider, it looks odd. I had checked the docs of concur and pyimgui but could not find anything about it.

image

BTW: Id voluntarily add everything you explain and have already explained to me to the concur docs, e.g. the log-widget with colored logging etc but do let me know where I would have to add the changes to.

EDIT: Solved by settings format to ""

potocpav commented 3 years ago

Glad you solved it. Improving the docs would indeed be great! The API documentation is generated from source code using the pdoc3 library (pip install pdoc3). For example, this docstring creates this record in the docs. For more information, see the pdoc3 documentation - but it's mostly just markdown.

To improve the docs, just find a relevant function/module, and modify its docstring. Run the mkdocs.sh script to test your changes - it updates the HTML documentation in the doc folder. You can then create a PR with the change to the python-concur repo. I can update python-concur-docs using mkdocs.sh myself.

If you have documentation which doesn't belong to the API docs, you can create PRs directly in the python-concur-docs repo by, for example, modifying/creating some of the Markdown files.