-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from RubendeBruin/qt
isse #33 : integrated Qt into plotter creation such that icons (axis)…
- Loading branch information
Showing
2 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sys | ||
from PyQt5 import Qt | ||
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor | ||
|
||
from vtkplotter import Plotter, Cone | ||
|
||
# settings.usingQt = True <-- not needed anymore, automatically triggered by passing a qtWidget to Plotter | ||
|
||
|
||
class MainWindow(Qt.QMainWindow): | ||
def __init__(self, parent=None): | ||
|
||
Qt.QMainWindow.__init__(self, parent) | ||
self.frame = Qt.QFrame() | ||
self.vl = Qt.QVBoxLayout() | ||
self.vtkWidget = QVTKRenderWindowInteractor(self.frame) | ||
self.vl.addWidget(self.vtkWidget) | ||
|
||
vp = Plotter(qtWidget=self.vtkWidget, axes=4, verbose=False) | ||
|
||
vp += Cone() | ||
vp.show() # to create renderer and add the actors | ||
|
||
# set-up the rest of the Qt window | ||
self.frame.setLayout(self.vl) | ||
self.setCentralWidget(self.frame) | ||
|
||
self.show() # <--- show the Qt Window | ||
|
||
|
||
if __name__ == "__main__": | ||
app = Qt.QApplication(sys.argv) | ||
window = MainWindow() | ||
app.exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters