Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve docstring of draw_idle() #12521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2018
Merged

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Oct 13, 2018

PR Summary

Trying to improve the docstring of draw_idle(). Though I'm not sure what exactly its pupose is and when it should be used. Can someone with more experience on the internals comment on this please?

@anntzer
Copy link
Contributor

anntzer commented Oct 14, 2018

Should be something like

        Request a widget redraw once control returns to the GUI event loop.

        Even if multiple calls to `draw_idle` occur before control
        returns to the GUI event loop, (backends should arrange that)
        the figure will only be rendered once.

where the parenthesis depends on whether you're writing the docs for backend implementers or for end users.

@timhoffm
Copy link
Member Author

Thanks. IMO the main audience of the docs are the end users. I've dropped the parenthesis but left my note instead. That keeps the information in but a bit separated.

Btw. can we make a suggestion to the end-user if she should call draw() or draw_idle()? We have both cases quite mixed in the examples.

@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commented Oct 14, 2018

If the draw event happens inside the event loop one should definitely call draw_idle(). Actually I think my very first PR here was about exactly that (#9064). If no event loop has been started, draw_idle() potentially has no effect.
There is also #5800, which suggests there actually is a drawback from calling it with non-GUI backends.

Copy link
Member

@NelleV NelleV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @timhoffm !

@NelleV NelleV merged commit 0ca0c40 into matplotlib:master Oct 20, 2018
@timhoffm timhoffm deleted the doc-draw-idle branch October 20, 2018 19:20
@QuLogic QuLogic added this to the v3.1 milestone Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants