pthom / imgui_bundle

Your fast track to powerful GUIs: Dear ImGui Bundle, an extensive toolkit for Python and C++ with immediate mode efficiency.
https://pthom.github.io/imgui_bundle/
MIT License
688 stars 71 forks source link

implot.setup_axis_links not working (python) #270

Closed ernestum closed 3 hours ago

ernestum commented 4 hours ago

I am using it like this:

timeline_start, timeline_end = implot.setup_axis_links(implot.ImAxis_.x1, timeline_start, timeline_end)

When I drag the x-axis, I see the change from one frame but it snaps back immediately. The implot.setup_axis_links function just returns the same axis limits that I pass in. That seems to be the cause.

pthom commented 3 hours ago

Hello,

Thanks for letting me know. This is fixed, the API had to change a bit:

def setup_axis_links(axis: ImAxis, link_min: BoxedValue, link_max: BoxedValue) -> None:
    """Links an axis range limits to external values. Use BoxedValue to transmit values (which will be updated after EndPlot)."""
    pass

# usage

# at init
timeline_start = implot.BoxedValue(0.0)
timeline_end = implot.BoxedValue(2 * np.pi)

...
# during render
implot.setup_axis_links(implot.ImAxis_.x1.value, timeline_start, timeline_end)
pthom commented 2 hours ago

You can download compiled wheels for this here https://github.com/pthom/imgui_bundle/actions/runs/11518147404