Force interactive matplotlib backend in pick_barrier
Some environments default matplotlib to Agg (non-interactive), which silently no-ops plt.show() — the picker would print "FigureCanvasAgg is non-interactive" and never display the thumbnail grid. Probe TkAgg > QtAgg > Qt5Agg > GTK3Agg before pyplot import. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
2b75daa783
commit
24403e0474
1 changed files with 11 additions and 0 deletions
|
|
@ -41,6 +41,17 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
import cv2
|
||||
import matplotlib
|
||||
# Reason: force an interactive backend so plt.show() actually opens a window.
|
||||
# Some environments (depending on matplotlibrc / DISPLAY / installed Qt-vs-Tk
|
||||
# bindings) default to Agg, which silently no-ops the picker. Try the common
|
||||
# GUI backends in order; fall through to whatever is set if none are available.
|
||||
for _backend in ("TkAgg", "QtAgg", "Qt5Agg", "GTK3Agg"):
|
||||
try:
|
||||
matplotlib.use(_backend, force=True)
|
||||
break
|
||||
except (ImportError, ValueError):
|
||||
continue
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue