pyvistaqt icon indicating copy to clipboard operation
pyvistaqt copied to clipboard

macOS `pvqt.BackgroundPlotter` never opens window

Open jamesstidard opened this issue 1 year ago • 2 comments

Hi,

I'm trying the time series example from the documentation:

from threading import Thread
import time
import numpy as np
import pyvista as pv
import pyvistaqt as pvqt
from pyvista import examples


globe = examples.load_globe()
texture = examples.load_globe_texture()
globe.point_data['scalars'] = np.random.rand(globe.n_points)
globe.set_active_scalars('scalars')


plotter = pvqt.BackgroundPlotter()
plotter.add_mesh(globe, lighting=False, show_edges=True, texture=texture, scalars='scalars')
plotter.view_isometric()

# shrink globe in the background
def shrink():
    for i in range(50):
        globe.points *= 0.95
        # Update scalars
        globe.point_data['scalars'] = np.random.rand(globe.n_points)
        time.sleep(0.5)

thread = Thread(target=shrink)
thread.start()

However, the window never seems to render for me, and not error is produced. What I do see is a macOS dock item bouncing (the loading animation for an application on macOS), and a transparent window I cannot interact with.

Here's some environment details. I'm running in a pipenv created virtual environment:

aiohttp==3.8.5
aiosignal==1.3.1
anyio==4.0.0
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asttokens==2.4.0
async-lru==2.0.4
async-timeout==4.0.3
attrs==23.1.0
autobahn==23.6.2
Babel==2.12.1
backcall==0.2.0
beautifulsoup4==4.12.2
bleach==6.0.0
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.2.0
comm==0.1.4
contourpy==1.1.0
cryptography==41.0.3
cycler==0.11.0
debugpy==1.6.7.post1
decorator==5.1.1
defusedxml==0.7.1
executing==1.2.0
fastjsonschema==2.18.0
fonttools==4.42.1
fqdn==1.5.1
frozenlist==1.4.0
hyperlink==21.0.0
idna==3.4
imageio==2.31.3
ipykernel==6.25.2
ipython==8.15.0
ipython-genutils==0.2.0
ipywidgets==8.1.0
isoduration==20.11.0
jedi==0.19.0
Jinja2==3.1.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.19.0
jsonschema-specifications==2023.7.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.7.0
jupyter-lsp==2.2.0
jupyter_client==8.3.1
jupyter_core==5.3.1
jupyter_server==2.7.3
jupyter_server_proxy==4.0.0
jupyter_server_terminals==0.4.4
jupyterlab==4.0.5
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.8
jupyterlab_server==2.24.0
kiwisolver==1.4.5
MarkupSafe==2.1.3
matplotlib==3.7.2
matplotlib-inline==0.1.6
mistune==3.0.1
multidict==6.0.4
nbclient==0.8.0
nbconvert==7.8.0
nbformat==5.9.2
nest-asyncio==1.5.7
notebook==7.0.3
notebook_shim==0.2.3
numpy==1.25.2
overrides==7.4.0
packaging==23.1
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow==10.0.0
platformdirs==3.10.0
pooch==1.7.0
prometheus-client==0.17.1
prompt-toolkit==3.0.39
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.16.1
pyparsing==3.0.9
PyQt5==5.15.9
PyQt5-Qt5==5.15.2
PyQt5-sip==12.12.2
python-dateutil==2.8.2
python-json-logger==2.0.7
pyvista==0.42.0
pyvistaqt==0.11.0
PyYAML==6.0.1
pyzmq==25.1.1
qtconsole==5.4.4
QtPy==2.4.0
referencing==0.30.2
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.10.2
scooby==0.7.2
Send2Trash==1.8.2
simpervisor==1.0.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.5
stack-data==0.6.2
terminado==0.17.1
tinycss2==1.2.1
tornado==6.3.3
traitlets==5.9.0
txaio==23.1.1
uri-template==1.3.0
urllib3==2.0.4
vtk==9.2.6
wcwidth==0.2.6
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.2
widgetsnbextension==4.0.8
yarl==1.9.2

Also I'm on macOS Ventura 13.5.1.

jamesstidard avatar Sep 06 '23 10:09 jamesstidard

Heya, just wondering if there's any additional details I can provide to help with this.

jamesstidard avatar Sep 13 '23 12:09 jamesstidard

I can reproduce this.

Adding plotter.app.exec_() as a last line resolves the issue for me.

Is that working for other platforms than MacOSX?

For reference, the example referred to is found here: https://docs.pyvista.org/version/stable/api/plotting/plotting.html#plot-time-series-data

jomade avatar Jun 26 '24 11:06 jomade