Skip to content

[Bug]: TextBox does not work with MacOSX backend #24372

Closed

Description

@rkishony

Bug summary

When creating widgets.TextBox with MacOSX backend, the text box is shown but cannot be edited.

Code for reproduction

%matplotlib osx
import matplotlib.pyplot as plt
from matplotlib.widgets import TextBox
TextBox(ax=plt.gca(), label='radius', initial='2')

Actual outcome

TextBox appear but is not active

Expected outcome

TextBox should allow editting

Additional information

No response

Operating system

osx

Matplotlib Version

2.5.3

Matplotlib Backend

MacOSX

Python version

3.10

Jupyter version

6.4.12

Installation

pip

Activity

  1. QuLogic commented on Nov 5, 2022

    @QuLogic
    Member
    TextBox(ax=plt.gca(), label='radius', initial='2')

    You need to assign this to something so it doesn't get garbage collected, as noted in its docs.

  2. rkishony commented on Nov 6, 2022

    @rkishony
    Author

    The bug persists even if we keep a reference to the TextBox.

    Namely, the following code produce a TextBox that is non-editable on MaxOSX backend (yet, it is ok on TK backend):

    %matplotlib osx
    import matplotlib.pyplot as plt
    from matplotlib.widgets import TextBox
    h = TextBox(ax=plt.gca(), label='radius', initial='2')
  3. greglucas commented on Nov 6, 2022

    @greglucas
    Contributor

    I'm able to edit the textbox on current main, so I think this has likely been fixed in a more recent version. 2.x is quite an old version of Matplotlib now and there has been a lot of work on the macosx backend since then.

    edit: This fails on 3.5.x, but is working on 3.6.x so the fix is only in the most recent release series.

  4. rkishony commented on Nov 6, 2022

    @rkishony
    Author

    fantastic - thanks !
    btw: the original issue was raised for Ver 3.5.3 (2.5.3 was a typo - sorry)

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions