-
Notifications
You must be signed in to change notification settings - Fork 505
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
does voila allow to get message from frontend? #346
Comments
Right, voila doesn't allow arbitrary code execution (execute requests). Only the following message types: However this doesn't seem to be the case in this example (at first glance). |
hi @jtpio, I don't know how to run voila there but everything you need is already included. |
@hainm thanks for sharing this, will have a look. To run voila on Binder you can use the server extension endpoint: https://mybinder.org/v2/gh/hainm/nglview/voila?urlpath=voila/render/notebooks%2Fmovie_making.ipynb |
thanks @jtpio. One possible explanation is that voila is trying to execute code from all the notebook cells before displaying the view. In my case, the view must be displayed before calling the movie maker. |
Probably related to this issue: #142 |
oops, likely not. I change the code a bit to only execute the movie making if a button is clicked, but that does not help. from IPython.display import *
from ipywidgets import * import nglview as nv
from nglview.contrib.movie import MovieMaker
import pytraj as pt
traj = pt.load(nv.datafiles.XTC, nv.datafiles.PDB)[:5]
view = nv.show_pytraj(traj, default=False)
view.center()
view.add_surface('protein', opacity=0.5, color='residueindex')
view.control.orient([15.69986420582941,
114.8276262266868,
48.816742057652796,
0,
-18.22863682402078,
-46.5629522451937,
115.38869989652724,
0,
123.43490126182644,
-21.481422658119275,
10.831316500165215,
0,
-39.1268284890941,
-46.69809684423501,
-44.63013982367478,
1])
movie = MovieMaker(view, in_memory=True, output='abc.gif')
def make(b):
movie.make()
button = Button(description='click me')
button.on_click(make)
view display(button), display(movie._progress) |
Yes. Also the notebook will display an error after running it with |
Hi,
How’s about my example above that uses the button click to generate the
animation?
…On Tue, Aug 13, 2019 at 6:15 AM Jeremy Tuloup ***@***.***> wrote:
Probably related to this issue: #142
<#142>
Yes. Also the notebook will display an error after running it with Restart
and run all, since the animation is being asynchronously generated and
not ready yet.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#346>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABB645IDPPN7RLB7EDPLMPLQEKCTNANCNFSM4IKVFJYA>
.
|
That should work. Are you running voila in standalone mode with the
|
Yes, standalone mode (by running voila in terminal). I don’t recall I used enable_nbextensions=True but how does this help? I can see the rendering but the movie animation does not work. |
the last example you pasted works fine here. |
hi @maartenbreddels, that does not work in my computer with voila 0.1.9. Here is the screenshot after 1 minute after I clicked the button. The expectation is the progress bar should be updated. |
@hainm any updates on this or still the same issue? |
Do you mean I should try the latest voila and report here? The issue happened with voila 0.1.9. |
Yes just to know if this was still an issue. |
thanks @jtpio, this example works like a champ with voila |
hi all,
I've been developing a feature in nglview for movie making of the trajectory snapshots.
Basically the backend will send 3D coordinates to frontend for rendering, the frontend will send back the image data (base64) to backend; once the backend got the image data, it will again send the next coordinates for next rendering.
I want to use
voila
to run the notebook app until it finished to get the movie output. However, it seems that voila does not allow the message from frontend. Is this correct? If yes, can voila have an option to allow that (which is similar to --enable_nbextensions=True).thanks
PS: The nglview feature is here and related code is here
The text was updated successfully, but these errors were encountered: