FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`macosx` cursors break with images · Issue #20797 · matplotlib/matplotlib · GitHub

Repository navigation

macosx cursors break with images #20797

Closed

Description

@QuLogic, I just tested the macosx cursors a bit. It didn't have anything to do with this PR. Master is the same behavior as 3.4.2.

Somehow it has to do with the plotted mappable on the axes...

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

ax.contourf([[0, 1], [2, 3]])  # cursor changes to the grab/zoom image
# ax.imshow([[0, 1], [2, 3]])  # cursor does not change

plt.show()

It works properly for contourf, but not for imshow/pcolormesh. The cursor works as expected for all mappables with qt5agg.

Originally posted by @greglucas in #20620 (comment)

Activity

  1. greglucas commented on Aug 5, 2021

    Contributor

    This works on v3.2.2, but not 3.3.0 and later. I'm not able to build 3.2.2 locally, so can't do a bisect to figure it out exactly. A quick diff of the _macosx.m file between those versions didn't yield anything immediately obvious to me either... Hopefully that helps someone else narrow down the issue.

  2. QuLogic commented on Aug 6, 2021

    MemberAuthor

    Could it be related to the mouse tracking changes in #16992?

  3. dstansby commented on Aug 25, 2021

    Member

    This bisects to 1857fca from #17092 by @anntzer

  4. anntzer commented on Aug 25, 2021

    Contributor

    I guess trying to display a 2-line status message may make macosx unhappy? No other idea for now...

  5. dstansby commented on Aug 26, 2021

    Member

    I guess trying to display a 2-line status message may make macosx unhappy? No other idea for now...

    Yep, this seems to be correct. Removing the newline here fixes the issue:

    s = s + '\n' + data_str

    I'm not sure what that means for fixing this though - I guess there's a bug somewhere in the macosx backend that needs fixing.

  6. greglucas commented on Nov 24, 2021

    Contributor

    I'm not exactly clear what the issue is here...
    If I pass in a string I format that matches what the format_data is sending myself, everything seems to work fine...
    message = 'x=\N{MINUS SIGN}0.1234 y=1.234\n[1.234]'
    However, as far as I can tell that same message when coming from that section of code, causes the cursor to be lost. I thought perhaps it had something to do with the MINUS SIGN unicode character, but that seems to be rendered fine in that string as well.

    The quick fix is to send in message = message.replace('\n', \t'), which still looks pretty good and you get the cursor back. But, it is a bit of a mystery to me why there is a difference even though the byte-codes seem to be identical to me.

  7. anntzer commented on Nov 24, 2021

    Contributor

    Probably(?) doesn't help, but

    diff --git i/lib/matplotlib/backends/backend_macosx.py w/lib/matplotlib/backends/backend_macosx.py
    index f9fb8713f4..2a12f1ca91 100644
    --- i/lib/matplotlib/backends/backend_macosx.py
    +++ w/lib/matplotlib/backends/backend_macosx.py
    @@ -116,9 +116,6 @@ class NavigationToolbar2Mac(_macosx.NavigationToolbar2, NavigationToolbar2):
             _tool = SubplotTool(self.canvas.figure, toolfig)
             return canvas
     
    -    def set_message(self, message):
    -        _macosx.NavigationToolbar2.set_message(self, message.encode('utf-8'))
    -
     
     @_Backend.export
     class _BackendMac(_Backend):
    diff --git i/src/_macosx.m w/src/_macosx.m
    index 366b786cf6..a547115175 100755
    --- i/src/_macosx.m
    +++ w/src/_macosx.m
    @@ -1130,7 +1130,7 @@ NavigationToolbar2_set_message(NavigationToolbar2 *self, PyObject* args)
     {
         const char* message;
     
    -    if (!PyArg_ParseTuple(args, "y", &message)) { return NULL; }
    +    if (!PyArg_ParseTuple(args, "s", &message)) { return NULL; }
     
         NSTextView* messagebox = self->messagebox;

    seems like a reasonable patch in any case?

  8. added this to the v3.6.0 milestone on May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL