admin管理员组文章数量:1122832
I am trying to get the SMILES from a JSME component through a callback within a python dash app.
I have been trying this example:
import dash
from dash import dcc, html, Input, Output
from dash_bio import Jsme
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("JSME Structure Drawing Example", style={'textAlign': 'center'}),
html.Div([
Jsme(
id='jsme-component',
width="800px",
height="400px"
),
html.Label("SMILES Output:", style={'marginTop': '20px'}),
dcc.Textarea(
id='smiles-output',
style={
'width': '100%',
'height': '100px',
'marginTop': '10px',
'fontFamily': 'monospace'
},
readOnly=True
)
])
])
@app.callback(
Output('smiles-output', 'value'),
Input('jsme-component', 'smiles') # Expecting the SMILES string from the Jsme component
)
def update_smiles(smiles):
if not smiles:
return "No structure drawn yet."
return smiles
if __name__ == '__main__':
app.run_server(debug=True)
I would like the SMILES to fill into the textbox as its drawn or after clicking some button. I would also be happy to understand what I did wrong and where I can find the right callbacks to use for components like jsme. I tried to find documentation through their GitHub etc but did not manage. Thank you
本文标签: pythonGet SMILES from Jsmecomponent through callbackStack Overflow
版权声明:本文标题:python - Get SMILES from Jsme-component through callback - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300187a1930726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论