update view after showmol command
andrejberg opened this issue · 1 comments
andrejberg commented
Hey,
I'm not sure if this is something that is even possible at the moment but what I would like to do is: change the view after showmol was called. So that I have selection elements under the 3D view.
st.session_state.view = py3Dmol.view()
st.session_state.view.addModel(system)
st.session_state.view.setStyle({"chain": "A"}, {"cartoon": {"color": "grey"}})
st.session_state.view.zoomTo()
showmol(st.session_state.view, height=500, width=800)
color = st.selectbox(....)
st.session_state.view.setStyle({"chain": "A"}, {"cartoon": {"color": color}})
Is there a way to do this? I tried view.update()
and calling showmol again but that gives no result or a second 3D view, respectively.
andrejberg commented
Ok sorry, found out that this is done by using session_state, too.
if "color" in st.session_state:
st.session_state.view.setStyle({"chain": "A"}, {"cartoon": {"color": st.session_state.color}})
st.session_state.view.zoomTo()
showmol(st.session_state.view, height=500, width=800)