GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Notify slider observers before redrawing in set_val by huzaifarahman13 · Pull Request #32587 · matplotlib/matplotlib

Conversation

@huzaifarahman13

@huzaifarahman13 huzaifarahman13 commented Nov 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR summary

Closes #32526

Slider.set_val and RangeSlider.set_val called draw_idle() before notifying the on_changed observers. Because of that, the first redraw showed stale state for any artists that were updated inside the callback.
This PR moves the redraw so it happens after the observers are notified, in both methods. Behaviour with drawon=False is unchanged.
I added test_slider_set_val_notifies_before_draw, which checks that the callback runs before the draw for both sliders, with drawon set to True and False. It fails on main and passes with this change.

AI Disclosure

I used an AI assistant to help locate the code and draft the change and test. I reviewed and ran everything locally and understand the change.

PR quality check

  • Use an expressive title
  • New and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New features and API changes have release notes
  • [N/A] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Huzaifa Rahman
Notify slider observers before redrawing in set_val
75b0457
@github-actions

github-actions Bot commented Nov 10, 2026

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added first-contribution topic: widgets/UI and removed first-contribution labels Nov 10, 2026
@huzaifarahman13 huzaifarahman13 mentioned this pull request Nov 10, 2026
[Bug]: Slider.set_val renders the figure before it notifies its observers, sometimes causing two renders per event #32526
Open

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: widgets/UI

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Slider.set_val renders the figure before it notifies its observers, sometimes causing two renders per event

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@huzaifarahman13
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.