Skip to content

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

Closed

Description

@ricardojdgferreira

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!

Activity

  1. 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?[/+] on Nov 13, 2024
  2. wang0618 commented on Nov 23, 2024

    @wang0618
    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)
  3. locked and limited conversation to collaborators on Nov 23, 2024
  4. converted this issue into a discussion #668 on Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions