Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Regression in widget behavior #30575

Copy link
Copy link
@larsoner

Description

@larsoner
Issue body actions

As of #29855 (according to git bisect) on nightly wheels in MNE-Python we now see:

_____________________ test_plot_raw_selection[matplotlib] ______________________
mne/viz/tests/test_raw.py:418: in test_plot_raw_selection
    fig._fake_keypress(sel_fig.mne.close_key, fig=sel_fig)
mne/viz/_mpl_figure.py:2249: in _fake_keypress
    _fake_keypress(fig, key)
mne/viz/utils.py:813: in _fake_keypress
    fig.canvas.callbacks.process(
/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages/matplotlib/cbook.py:365: in process
    func(*args, **kwargs)
/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages/matplotlib/widgets.py:2338: in on_key_press
    self.clear()
/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages/matplotlib/widgets.py:2383: in clear
    self.update()
/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages/matplotlib/widgets.py:2240: in update
    self.canvas.restore_region(self.background)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: 'FigureCanvasBase' object has no attribute 'restore_region'

Locally I can see:

../matplotlib/lib/matplotlib/widgets.py:2221: in update
    self.canvas.restore_region(self.background)
E   AttributeError: 'FigureCanvasBase' object has no attribute 'restore_region'
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/larsoner/python/matplotlib/lib/matplotlib/widgets.py(2221)update()
-> self.canvas.restore_region(self.background)
(Pdb) p type(self)
<class 'matplotlib.widgets.LassoSelector'>
(Pdb) p self.canvas
<matplotlib.backend_bases.FigureCanvasBase object at 0x7f47ede5ca50>
(Pdb) u
(Pdb) u
(Pdb) u
(Pdb) u
> /home/larsoner/python/mne-python/mne/viz/utils.py(813)_fake_keypress()
-> fig.canvas.callbacks.process(
(Pdb) p fig
<MNESelectionFigure size 300x700 with 3 Axes>

MNESelectionFigure subclasses MNEFigure which subclasses matplotlib.figure.Figure.

I'm hoping this is enough to see the problem and know the solution. But if not, let me know and I'll take the time to whittle this down to a MWE! There might also be some way we are misusing/simulating keypresses in tests or something, but we haven't changed that code in years AFAIK so if this breaks things for us I wouldn't be surprised if it breaks things for others, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.