Issue with `brain.show_view` flashing quickly

Description
I am facing a challenge while using the Brain.show_view(azimuth=90, elevation=90, distance=500) function in MNE-Python. Specifically, I intend to set up a window that remains open, allowing me to interact with it freely. However, the popped-up image window quickly flashes and closes, terminating the program. How can I achieve my goal of having a persistent, interactive window?

Background
Operating System: Windows 10
Python Version: 3.8.5
MNE Version: 0.24.1
PyVista Version: 0.30.0
IDE: PyCharm

Code

mne.viz.set_3d_backend('pyvistaqt')
subjects_dir = os.path.join(r'D:\Code\data\berlin_NIRS-EEG\NIRS_MNE\download')
mne.datasets.fetch_fsaverage(subjects_dir=subjects_dir)
brain = mne.viz.Brain('fsaverage', subjects_dir=subjects_dir, alpha=0.5, cortex='low_contrast')
brain.add_head()
brain.add_sensors(nirs_raw.info, trans="fsaverage", fnirs=["channels", "pairs", "sources", "detectors"])
brain.show_view(azimuth=90, elevation=90, distance=500)

Hello, please see this posting:

Best wishes,
Richard

1 Like