0

I am creating a GUI with PyQt5, in the main window I have a QFrame, after some calculations, a mesh is added to this object, however, not until I mouse-click while hovering on the QFrame area does the plotted mesh appear on the screen.

I am trying to make this automatic, so that once my mesh is calculated the QFrame updates and plots right away. Does anybody have any ideas on how to do this?

Important lines of code as I have them look like the lines below. In a separate file I have a class with all the properties of the GUI, from which the main class inherits. In the main class, the mesh is obtained and added to the QFrame.

when plotMesh() is called, the mesh is added to the QFrame, but I have to later click on the QFrame to se the image.

What I would like to happen is that the QFrame updates its content as soon as plotMesh() ends

class Ui_MainWindow(object):
   def setupUi(self, MainWindow)
        # ...
        self.vtkFrame = QtWidgets.QFrame(self.layoutWidget)
        # ...
   # ...


import pyvista as pv

class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
   def __init__(self, *args, **kwargs):
        # ...
        self.vtk_widget = pv.QtInteractor(self.vtkFrame)
        # ...
   # ...

   def plotMesh()
        # ...
        r_vtk = XXX  # XXX stands for functions and calculations 
                     # to get the mesh
        self.vtk_widget.add_mesh(r_vtk)
   #...
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
jLordMey
  • 9
  • 3
  • Well you can do one of two things at this point without the MRE -- you can either call the mouse click event for that object or you can determine what is getting activated when you click your mouse on that object and then call that. Aka use the wheel that is on the vehicle (or figure out how the wheel works) rather than invent something of your own – Dennis Jensen Sep 18 '19 at 15:03
  • SOLVED! for anybody reading who might need it, theres a pyvista built-in function you can call to force the QFrame to update its contents, pv.update() – jLordMey Sep 20 '19 at 10:41

0 Answers0