pythonpysidepyqt6pyvista

PyVista Plotter in QFrame doesn't fill the full frame


I want to make a GUI with QtDesigner.

There is a QFrame for the PyVista plot but the plot doesn't fill the full frame.

Here is my code:

from PySide6.QtWidgets import QApplication, QMainWindow
from QT_Designer.Validation import Ui_MainWindow
from pyvistaqt import QtInteractor, MainWindow


class Frm_main(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        # Window (Plotter or Frame)
        self.plotter = QtInteractor(self.f_window)  

The plot just fills half of the frame

I tried to set the plotter to full_screen or change the layout of the frame but neither fixes the issue.


Solution

  • I looked at a view examples and find now a solution:

    from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout
    from QT_Designer.Validation import Ui_MainWindow
    from pyvistaqt import QtInteractor, MainWindow
    
    class Frm_main(QMainWindow, Ui_MainWindow):
        def __init__(self):
            super().__init__()
            self.setupUi(self)
    
            vlayout = QVBoxLayout()
    
            # Window (Plotter or Frame)
            self.plotter = QtInteractor(self.f_window)  
            vlayout.addWidget(self.plotter.interactor)
            self.f_window.setLayout(vlayout)
    

    Now the plotter is in the full frame :)