Skip to content

Improve rubberband rendering in wx and tk #23985

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 3 commits into from
Oct 20, 2022

Conversation

oscargus
Copy link
Member

PR Summary

Closes #23969 (as there is a separate OSX issue #23777)

Draw a solid white rectangle and then add a dashed black rectangle so that it works on both light and dark backgrounds. For the tk backend it messes up the deprecated lastrect as bit since it only can contain one of the two rectangles. Not sure what lastrect is used for. If it is only to get the position it should be OK, but if it is to possibly modify the rectangle it may not work.

No obvious way to test it in the CI.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@oscargus oscargus added this to the v3.6.1 milestone Sep 22, 2022
@QuLogic QuLogic modified the milestones: v3.6.1, v3.6.2 Oct 6, 2022
[(x0, y0, x1, y0), (x1, y0, x1, y1),
(x0, y0, x0, y1), (x0, y1, x1, y1)],
wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))
x0, y0, x1, y1 = map(round, self._rubberband_rect)
Copy link
Member Author

@oscargus oscargus Oct 15, 2022

Choose a reason for hiding this comment

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

Earlier it was possible that the left and bottom bounds could be one pixel off as int truncates. Using round seems to improve the situation, at least based on practical tests.

@tacaswell tacaswell merged commit d099170 into matplotlib:main Oct 20, 2022
@tacaswell
Copy link
Member

I manually tested tk.

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 20, 2022
QuLogic added a commit that referenced this pull request Oct 21, 2022
…985-on-v3.6.x

Backport PR #23985 on branch v3.6.x (Improve rubberband rendering in wx and tk)
@oscargus oscargus deleted the rubberband branch October 22, 2022 05:51
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
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.

[ENH]: Make rubber band more visible
4 participants