File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import pyvista as pv
2+ import sys
3+
4+ st_mode = "-gui" not in sys .argv
5+
6+ print ("Starting it all..." )
7+
8+ if st_mode :
9+ import streamlit as st
10+
11+ st .set_page_config (layout = "wide" )
12+
13+ from stpyvista .utils import start_xvfb
14+
15+ if "IS_XVFB_RUNNING" not in st .session_state :
16+ start_xvfb ()
17+ st .session_state .IS_XVFB_RUNNING = True
18+
19+ st .title ("OpenWorm 3D Viewer" )
20+
21+
22+ ## Initialize a plotter object
23+ plotter = pv .Plotter (window_size = [800 , 600 ])
24+
25+ print ("Read objs..." )
26+
27+ plotter .add_axes ()
28+ plotter .enable_mesh_picking (show_message = True )
29+
30+ sphere = pv .Sphere (end_theta = 90 )
31+ plotter .add_mesh (sphere )
32+
33+ ## Final touches
34+ plotter .view_isometric ()
35+ # plotter.add_scalar_bar()
36+ plotter .background_color = "white"
37+
38+ print ("Created the scene..." )
39+
40+ if st_mode :
41+ ## Pass a key to avoid re-rendering at each page change
42+ if False :
43+ from stpyvista import stpyvista
44+
45+ stpyvista (plotter , key = "pv_cube" )
46+ pass
47+ else :
48+ plotter .show ()
You can’t perform that action at this time.
0 commit comments