From d31c40aa2dd8a205261e4ecd6253fc7baf17a5dc Mon Sep 17 00:00:00 2001 From: Bane Sullivan Date: Sun, 15 Oct 2023 18:35:19 -0700 Subject: [PATCH] Attempt load data from file --- main.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 0d516e3..4900c40 100644 --- a/main.py +++ b/main.py @@ -58,26 +58,22 @@ def __init__(self, parent=None, show=True): exitButton.triggered.connect(self.close) fileMenu.addAction(exitButton) - # allow adding a sphere - meshMenu = mainMenu.addMenu("Mesh") - self.add_sphere_action = QtWidgets.QAction("Add Sphere", self) - self.add_sphere_action.triggered.connect(self.add_sphere) - meshMenu.addAction(self.add_sphere_action) + clr_menu = mainMenu.addMenu("Clear") + clr_menu.addAction("Clear", self.plotter.clear_actors) - # demonstrate using a built-in asset - self.plotter.add_mesh(pv.read(DOGE_FILE), color="tan") + self.plotter.main_menu = mainMenu if show: self.show() - def add_sphere(self): - """add a sphere to the pyqt frame""" - sphere = pv.Sphere() - self.plotter.add_mesh(sphere, show_edges=True) - self.plotter.reset_camera() + +def add_data(plotter): + mesh = pv.read("sample.vtk") + plotter.add_mesh(mesh, show_edges=True) if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) window = MyMainWindow() + add_data(window.plotter) sys.exit(app.exec_())