1111 vtkRenderWindowInteractor ,
1212)
1313
14- # Required for interacter factory initialization
14+ # Required for interactor initialization
1515from vtkmodules .vtkInteractionStyle import vtkInteractorStyleSwitch # noqa
1616
17- # Required for remote rendering factory initialization, not necessary for
17+ # Required for rendering initialization, not necessary for
1818# local rendering, but doesn't hurt to include it
19-
2019import vtkmodules .vtkRenderingOpenGL2 # noqa
2120
2221# -----------------------------------------------------------------------------
3635renderWindowInteractor = vtkRenderWindowInteractor ()
3736renderWindowInteractor .SetRenderWindow (renderWindow )
3837renderWindowInteractor .GetInteractorStyle ().SetCurrentStyleToTrackballCamera ()
39- renderWindowInteractor .EnableRenderOff ()
4038
4139cone_source = vtkConeSource ()
4240mapper = vtkPolyDataMapper ()
4644
4745renderer .AddActor (actor )
4846renderer .ResetCamera ()
49- renderWindow .Render ()
5047
5148# -----------------------------------------------------------------------------
5249# Functions
5350# -----------------------------------------------------------------------------
5451
5552
56- def update_view (** kwargs ):
57- html_view .update ()
58-
59-
6053@change ("resolution" )
6154def update_resolution (resolution , ** kwargs ):
6255 cone_source .SetResolution (resolution )
63- update_view ()
56+ html_view . update ()
6457
6558
6659def reset_resolution ():
@@ -71,9 +64,18 @@ def reset_resolution():
7164# GUI
7265# -----------------------------------------------------------------------------
7366
74- layout = SinglePage ("Hello trame" , on_ready = update_view )
67+ html_view = vtk .VtkLocalView (renderWindow )
68+
69+ layout = SinglePage ("Hello trame" , on_ready = html_view .update )
7570layout .title .set_text ("Hello trame" )
7671
72+ with layout .content :
73+ vuetify .VContainer (
74+ fluid = True ,
75+ classes = "pa-0 fill-height" ,
76+ children = [html_view ],
77+ )
78+
7779with layout .toolbar :
7880 vuetify .VSpacer ()
7981 vuetify .VSlider (
@@ -85,30 +87,18 @@ def reset_resolution():
8587 dense = True ,
8688 style = "max-width: 300px" ,
8789 )
88- with vuetify .VBtn (
89- icon = True ,
90- click = reset_resolution ,
91- ):
90+ with vuetify .VBtn (icon = True , click = reset_resolution ):
9291 vuetify .VIcon ("mdi-restore" )
9392 vuetify .VDivider (vertical = True , classes = "mx-2" )
93+
9494 vuetify .VSwitch (
9595 v_model = "$vuetify.theme.dark" ,
9696 hide_details = True ,
97+ dense = True ,
9798 )
98- with vuetify .VBtn (
99- icon = True ,
100- click = "$refs.view.resetCamera()" ,
101- ):
99+ with vuetify .VBtn (icon = True , click = "$refs.view.resetCamera()" ):
102100 vuetify .VIcon ("mdi-crop-free" )
103101
104- html_view = vtk .VtkLocalView (renderWindow )
105-
106- with layout .content :
107- vuetify .VContainer (
108- fluid = True ,
109- classes = "pa-0 fill-height" ,
110- children = [html_view ],
111- )
112102
113103# -----------------------------------------------------------------------------
114104# Main
0 commit comments