Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stspeck unexpected behaviour with widget click #8

Open
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

avrabyt
Copy link

@avrabyt avrabyt commented May 23, 2022

Hi! Thanks for this wrapper stspeck, indeed it will be very helpful 🎉
Was just playing with it while serving in the local server, found some unusual behaviour, please do correct me if I'm missing something here.

Btw, here's my code snippet 👇

import streamlit as st
from ipyspeck import stspeck


atom_Scale = st.sidebar.slider('Atom Scale', 0.1, 1.0, 0.35)
bond_Scale = st.sidebar.slider('Bond Scale', 0.1, 1.0, 0.5)
atom_Shade = st.sidebar.slider('Atom Shade', 0.1, 1.0, 0.0)
bondThreshold = st.sidebar.slider('Bond Threshold', 0.1, 5.0, 1.2)
bonds = st.sidebar.checkbox("Bonds",value = True)
outline = st.sidebar.checkbox('Outline',value = True)

_xyz = '''3
Water molecule
O          0.00000        0.00000        0.11779
H          0.00000        0.75545       -0.47116
H          0.00000       -0.75545       -0.47116
'''

spec_xyz = stspeck.Speck(
data=_xyz,
atomScale=atom_Scale,
bondScale=bond_Scale,
outline=outline,
atomShade=atom_Shade,
bonds=bonds,
bondThreshold=bondThreshold,
width="800px",
height="600px"
)

Once the ipywidgets are triggered, the change is implemented and soon the code runs from the very beginning and the initial state of the molecule is retained. For example trying to convert to ball-stick model, or trying with different color scheme. idk, but probably one way would be store the trigger in a session-state variable . However, I haven't checked it in the deployed application.

(P.S apologies if I'm missing something 😢 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants