Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Add blitting support to button widgets#23457
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
QuLogic commentedJul 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
As a test, you can run: importmatplotlib.pyplotaspltfrommatplotlib._apiimportsuppress_matplotlib_deprecation_warningfrommatplotlib.widgetsimportButton,CheckButtons,RadioButtonsforuseblitin [False,True]:fig,axs=plt.subplots(10,10,constrained_layout=True)fig.suptitle(f'Button(useblit={useblit})')fig._buttons= [Button(ax,f'Test{i}',useblit=useblit)fori,axinenumerate(axs.flat) ]forbutton_classin (CheckButtons,RadioButtons):foruseblitin [False,True]:fig,axs=plt.subplots(10,10,constrained_layout=True)fig.suptitle(f'{button_class.__name__}(useblit={useblit})')fig._buttons= [button_class(ax, [f'Test{4*i+j}'forjinrange(4)],useblit=useblit)fori,axinenumerate(axs.flat) ]forbuttoninfig._buttons[::2]:withsuppress_matplotlib_deprecation_warning():ifisinstance(button,RadioButtons):button.circles# Trigger deprecated behaviour.else:button.linesplt.show() which for |
QuLogic commentedNov 29, 2022
Rebased to work with |
Uh oh!
There was an error while loading.Please reload this page.
anntzer commentedNov 30, 2022
Looks good, but perhaps this should wait for#24474 to be merged first (and blitting adapted to the new checkboxes as well)? |
| ifself.drawon: | ||
| self.ax.figure.canvas.draw() | ||
| ifself._useblit: | ||
| self.ax.draw_artist(self.ax) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you confirm that Button doesn't use copy_from_bbox/restore_region like the other two widgets because the button covers the entire axes anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes, and it's strictly a rectangle, socopy_from_bbox/restore_region would effectively be directly overwritten immediately.
QuLogic commentedDec 29, 2022
I also wonder if the default should be |
anntzer commentedDec 29, 2022
Seems reasonable. |
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).