-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update blocking_input.py #11661
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
Update blocking_input.py #11661
Conversation
ginput doesn´t allow to disable buttons. With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan. Only one issue. I´m just starting with python (only worked with matlab and VB, you can tell my proficiency by that alone, so please don´t be too harsh if I made any mistake) and I don´t know if this change in BlockingMouseInput will create a regression issue to any other matplotlib function. Thanks.
Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom
@@ -135,7 +135,7 @@ def mouse_event(self): | |||
self.mouse_event_pop(event) | |||
elif button == self.button_stop: | |||
self.mouse_event_stop(event) | |||
else: | |||
elif self.button_add: |
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.
Shouldn't this be elif button == self.button_add:
?
Or am I overlooking something and there is actually an asymmetry that there are other buttons that should be implicitly be handled as add event if button_add
is defined?
@@ -2139,10 +2139,13 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, | |||
If True, show a red cross at the location of each click. | |||
mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click) | |||
Mouse button used to add points. | |||
Use a different button value to disable this mouse action. |
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.
Probably we should use None
to disable an action.
You are probably right.
Sorry. It's my lack of knowledge. I'm still learning. Tried this and worked.
El dom., 15 jul. 2018 12:38, Tim Hoffmann <notifications@github.com>
escribió:
… ***@***.**** commented on this pull request.
------------------------------
In lib/matplotlib/blocking_input.py
<#11661 (comment)>
:
> @@ -135,7 +135,7 @@ def mouse_event(self):
self.mouse_event_pop(event)
elif button == self.button_stop:
self.mouse_event_stop(event)
- else:
+ elif self.button_add:
Shouldn't this be elif button == self.button_add:?
Or am I overlooking something and there is actually an asymmetry that
there are other buttons that should be implicitly be handled as add event
if button_add is defined?
------------------------------
In lib/matplotlib/figure.py
<#11661 (comment)>
:
> @@ -2139,10 +2139,13 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1,
If True, show a red cross at the location of each click.
mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click)
Mouse button used to add points.
+ Use a different button value to disable this mouse action.
Probably we should use None to disable an action.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11661 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARdpxunukA_ecQVis2yvdbrkm-OQWvprks5uGxu9gaJpZM4VQKLf>
.
|
Superseded by #12199 . |
ginput doesn´t allow to disable buttons.
With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan.
Only one issue. I´m just starting with python (only worked with matlab and VB, you can tell my proficiency by that alone, so please don´t be too harsh if I made any mistake) and I don´t know if this change in BlockingMouseInput will create a regression issue to any other matplotlib function.
Thanks.
PR Summary
PR Checklist