Skip to content

Conversation

@thiago4455
Copy link
Contributor

Removes the use of the function tostring_rgb which was deprecated in matplotlib version 3.8, and removed recently in version 3.10.

Previous error:

File ".../lib/python3.13/site-packages/imgui_bundle/demos_python/demos_immapp/demo_matplotlib.py", line 60, in gui
    imgui_fig.fig("Animated figure", animated_figure.fig, refresh_image=True, show_options_button=False)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.13/site-packages/imgui_bundle/imgui_fig.py", line 102, in fig
    image_rgb = _fig_to_image(label_id, figure, refresh_image)
  File ".../lib/python3.13/site-packages/imgui_bundle/imgui_fig.py", line 56, in _fig_to_image
    buf = numpy.fromstring(figure.canvas.tostring_rgb(), dtype=numpy.uint8)  # type: ignore
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'?

@pthom
Copy link
Owner

pthom commented Jan 5, 2025

Nice catch, thanks!

@pthom pthom merged commit 4665252 into pthom:main Jan 5, 2025
29 checks passed
@pthom
Copy link
Owner

pthom commented Jan 5, 2025

I merged your changes

@thiago4455
Copy link
Contributor Author

Thanks! Also thank you for maintaining this project, you're a godsend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants