Skip to content

Can BackgroundPlotter refresh and redraw in a loop? #595

@rruixxu

Description

@rruixxu

I just want to draw a sequence of different mesh and implement it in a loop by BackgroundPlotter. But I have tried my best to figure out how to do that.
In the following code, I have to place plotter.app.exec_() at the end of the loop to realize interactive zoom in and pan. However, the window will not go on to the next iteration. I tried to place input() or sleep() at the end of the loop, but making window non-interactive then.
I just want to simulate the window behavior of opencv which can block the iteration util I press some keys or util certain time. How can I do that?

import pyvista as pv
from pyvistaqt import BackgroundPlotter

sphere = pv.Sphere()
scale = 2

plotter = BackgroundPlotter()
for i in range(4):
    plotter.clear()
    sphere.points *= scale
    plotter.add_mesh(sphere)
    plotter.app.exec_()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions