Skip to content

Commit

Permalink
Attempt load data from file
Browse files Browse the repository at this point in the history
  • Loading branch information
banesullivan committed Oct 16, 2023
1 parent a9fd1ee commit d31c40a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_())

0 comments on commit d31c40a

Please sign in to comment.