Skip to content

[ENH]: Make rubber band more visible #23969

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

Closed
komoto48g opened this issue Sep 20, 2022 · 5 comments · Fixed by #23985
Closed

[ENH]: Make rubber band more visible #23969

komoto48g opened this issue Sep 20, 2022 · 5 comments · Fixed by #23985
Labels
Good first issue Open a pull request against these issues if there are no active ones! GUI: MacOSX GUI: tk GUI: wx New feature
Milestone

Comments

@komoto48g
Copy link

Problem

If the image is dark such as diffraction patterns, the rubber band is hardly visible.

Proposed solution

Candidates would be,

  1. Draw xor masked line (similar to Cursor).
  2. Paint with a semi-transparent color inside the rectangle (similar to ver 3.3.4).

Clipboard01

@QuLogic
Copy link
Member

QuLogic commented Sep 20, 2022

With what backend? The rubber band should be alternating black and white in most (but not all in 3.5.3, IIRC.)

@anntzer
Copy link
Contributor

anntzer commented Sep 21, 2022

IIRC it's wx which used that colored rectangle previously. Currently it doesn't draw the white dashes; seems straightforward enough to add that. Looking at other backends, I believe tk and macos also need the improvement.
Marking as good first issue (but medium as you need to fiddle with GUI toolkits (and ObjC for the macos backend) -- it's not necessary for a PR to handle all backends at once).

@anntzer anntzer added GUI: wx GUI: MacOSX GUI: tk Good first issue Open a pull request against these issues if there are no active ones! labels Sep 21, 2022
@oscargus
Copy link
Member

The MacOS-backend has a separate issue with a bit of possibly useful details: #23777

@oscargus
Copy link
Member

oscargus commented Sep 21, 2022

For wx one can add the following line

            drawDC.DrawLineList(
                [(x0, y0, x1, y0), (x1, y0, x1, y1),
                 (x0, y0, x0, y1), (x0, y1, x1, y1)],
                wx.Pen('WHITE', 1, wx.PENSTYLE_SOLID))

before

drawDC.DrawLineList(
[(x0, y0, x1, y0), (x1, y0, x1, y1),
(x0, y0, x0, y1), (x0, y1, x1, y1)],
wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))

to get a black-white-line as discussed in #23777

wx does not support 0-length dashes, so one cannot start with a gap (as far as I can tell).

Bonuses:

  • Only create the point-list once per call
  • Only create the pens once per CanvasBase instance.

@komoto48g
Copy link
Author

Thank you for your consideration of this issue. I tested on Windows 10 with matplotlib 3.5.3/WxAgg and TkAgg. The two seem slightly different:
WxAgg => black dashed line
TkAgg => black solid line
The black and white line is also nice.

@oscargus oscargus added this to the v3.6.1 milestone Sep 23, 2022
@QuLogic QuLogic modified the milestones: v3.6.1, v3.6.2 Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Open a pull request against these issues if there are no active ones! GUI: MacOSX GUI: tk GUI: wx New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants