pyvista
pyvista copied to clipboard
Window freeze with show(interactive_update=True)
Describe the bug, what's wrong, and what you expected.
I need a bit more control of how I can interact with pyvista window. Thus I found out about the interactive_update parameter in show. But now I encountered some problems, like (see section reproduce bug).
I think the most annoying problem is that by simply closing the window, it starts to close and re-open the window in an endless loop. If the process_event line is added, the loop seems to work fine until after closing the window:
RuntimeError: Render window interactor must be initialized before processing events.
I assume that immediately, after I successfully close the window, it starts to complain about not having an interactor, which makes sense.
Then, if I interact by setting plot_close to True in this case, the line plotter.close() does not work properly. It simply freezes the window, which needs to be externally force quit.
My questions are:
- Is there a way to let me know if I hit the close button of the window so that I can gracefully break the loop?
- Is the freezing of the window reproducible, or is it a "me"-problem?
Steps to reproduce the bug.
[...]
plotter = pv.Plotter()
points = np.random.random((30, 3))
d_pd = pv.PolyData(points)
plotter.show(interactive_update=True)
while True: # Question, how can I gracefully stop loop, if I manually close window via "X" button?
plotter.update()
if plot_close: # Exemplary, by, for example another thread or key_event
plotter.close() # Issue, this doesn't close pyvista window, it only freezes it.
break
plotter.iren.process_events() # By adding this line, closing with "X" button works correctly, but another problem arises
[...]
System Information
--------------------------------------------------------------------------------
Date: Mon Jun 17 13:05:24 2024 CEST
OS : Linux (Ubuntu 24.04)
CPU(s) : 12
Machine : x86_64
Architecture : 64bit
Environment : Python
GPU Vendor : Intel
GPU Renderer : Mesa Intel(R) Graphics (RPL-U)
GPU Version : 4.6 (Core Profile) Mesa 24.0.5-1ubuntu1
MathText Support : True
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0]
pyvista : 0.43.9
vtk : 9.3.0
numpy : 1.26.4
matplotlib : 3.6.3
scooby : 0.10.0
pooch : 1.8.2
pillow : 10.2.0
pyvistaqt : 0.11.0
PyQt5 : 5.15.10
IPython : 8.20.0
scipy : 1.11.4
--------------------------------------------------------------------------------
Screenshots
No response