def test_doc_00(self): # Create the figure. This automatically sets itself as the current # working figure. The qapp is created automatically if one doesn't # already exist. vpl.QtFigure("Exciting Window Title") # Everything from here on should be exactly the same as normal. vpl.quick_test_plot()
def test_qfigure(self): fig = vpl.QtFigure("a qt widget figure") self.assertIs(fig, vpl.gcf()) direction = np.array([1, 0, 0]) vpl.quiver(np.array([0, 0, 0]), direction) vpl.view(camera_direction=direction) vpl.reset_camera() vpl.show()
def __init__(self): super().__init__() # Go for a vertical stack layout. vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) # Create the figure self.figure = vpl.QtFigure(parent=self) # Create a button and attach a callback. self.button = QtWidgets.QPushButton("Make a Ball") self.button.released.connect(self.button_pressed_cb) # QtFigures are QWidgets and are added to layouts with `addWidget` vbox.addWidget(self.figure) vbox.addWidget(self.button)
def test_qfigure(): vpl.QtFigure._abc_assert_no_abstract_methods() self = vpl.QtFigure("a Qt widget figure") assert self is vpl.gcf() direction = np.array([1, 0, 0]) vpl.quiver(np.array([0, 0, 0]), direction) vpl.view(camera_direction=direction) vpl.reset_camera() self.show(block=False) self.close() self.showMaximized(block=not VTKPLOTLIB_WINDOWLESS_TEST) out = vpl.screenshot_fig(fig=self) vpl.close(fig=self) globals().update(locals()) return out