Exception not handled in widgetlock()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Riproduci il problema con l’esempio minimo di Jupyter, quindi ispeziona ipympl/backend_nbagg.py e matplotlib/widgets.py in corrispondenza della gestione del lock del widget mostrata nel traceback. Conferma il comportamento previsto quando un’operazione di zoom o panoramica tenta di acquisire un lock occupato e aggiungi una copertura che dimostri che l’interazione non produce più un ValueError non gestito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the issue
I want to use a selector matplotlib.widgets.RectangleSelector , it is incompatible with zoom and pan
So I try to call widget lock to prevent user from using zoom in the same time.
minimum code:
%matplotlib ipympl
import matplotlib.pyplot as plt
fig,ax = plt.subplots()
ax.plot([0,1],[0,1])
fig.canvas.widgetlock(ax) # get the widget lock
if you then hit the zoom or pan matplotlib button, which also try to get the lock, you get
ValueError Traceback (most recent call last)
File ~/spike/venvOW/lib/python3.9/site-packages/ipympl/backend_nbagg.py:279, in Canvas._handle_message(self, object, content, buffers)
276 self.manager.handle_json(content)
278 else:
--> 279 self.manager.handle_json(content)
...
File ~/spike/venvOW/lib/python3.9/site-packages/matplotlib/widgets.py:42, in LockDraw.__call__(self, o)
40 """Reserve the lock for *o*."""
41 if not self.available(o):
---> 42 raise ValueError('already locked')
43 self._owner = o
ValueError: already locked
Alternatively, I could use the right click for the selector, but I have not found a way to restrict zoom and pan to left click only.
Versions
3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0]
ipympl version: 0.8.8
Selected Jupyter core packages...
IPython : 8.0.1
ipykernel : 6.9.1
ipywidgets : 7.6.5
jupyter_client : 7.1.2
jupyter_core : 4.9.2
jupyter_server : 1.13.5
jupyterlab : not installed
nbclient : 0.5.11
nbconvert : 6.4.2
nbformat : 5.1.3
notebook : 6.4.8
qtconsole : 5.2.2
traitlets : 5.1.1
- Lingua principale
- Jupyter Notebook
- Stelle
- 1.7k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di matplotlib/ipympl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#623 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#622 · 13 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#612 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
matplotlib/ipympl#611 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#609 · 7 commenti ·
Tutte le issue di matplotlib/ipympl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
lobehub/lobe-icons#422 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
www.guideflow.com ApertaN: AdGuard Browser Extension P4: Low T: Social Widget
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AdguardTeam/AdguardFilters#242250 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100