Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Feature Request] Is there anyway to make py3Dmol to work using put_html? #666

Closed
ricardojdgferreira opened this issue Nov 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ricardojdgferreira
Copy link

ricardojdgferreira commented Nov 12, 2024

Please move to Discussions - Feature Request for posting.

I have this code to embed py3Dmol viewer into web pages.

<script src="https://3Dmol.org/build/3Dmol-min.js"></script>     
<script src="https://3Dmol.org/build/3Dmol.ui-min.js"></script>     
 
<div style="height: 400px; width: 400px; position: relative;" class='viewer_3Dmoljs' data-pdb='2POR' data-backgroundcolor='0xffffff' data-style='stick' data-ui='true'></div>

I know that it sets the viewport (div), but I cannot seem to render anything inside it.
How can I make it to work (or is it something that can be implemented in PyWebIO)?

Thanks!

@ricardojdgferreira ricardojdgferreira added the enhancement New feature or request label Nov 12, 2024
@ricardojdgferreira ricardojdgferreira changed the title [Feature Request] Is there anyway to make NGLViewer.js to work using put_html? [Feature Request] Is there anyway to make py3Dmol to work using put_html? Nov 13, 2024
@wang0618
Copy link
Member

You can use pywebio.output.put_html() to show py3dmol view, here is a example:

from pywebio import output, start_server
import py3Dmol

def app():
    viewer = py3Dmol.view(query='pdb:5WOG')
    viewer.show()
    html = viewer._make_html()
    output.put_html(html)


if __name__ == '__main__':
    start_server(app, port=8080)

@pywebio pywebio locked and limited conversation to collaborators Nov 23, 2024
@wang0618 wang0618 converted this issue into discussion #668 Nov 23, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants