Skip to content

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

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
rkishony opened this issue Nov 5, 2022 · 4 comments
Closed

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

rkishony opened this issue Nov 5, 2022 · 4 comments

Comments

@rkishony
Copy link

rkishony commented Nov 5, 2022

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

@QuLogic
Copy link
Member

QuLogic commented Nov 5, 2022

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.

@rkishony
Copy link
Author

rkishony commented Nov 6, 2022

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')

@greglucas
Copy link
Contributor

greglucas commented Nov 6, 2022

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.

@rkishony
Copy link
Author

rkishony commented Nov 6, 2022

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

@rkishony rkishony closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants