Running a tkinter canvas animation in using Streamlit (part II)

We have a local application that runs an animation on a canvas in tkinter. Would it be possible to run such a program in the cloud with and show the animation on the client side?

If so, how?

This question was asked 15 days ago but sofar no single response.
Also if it is not possible we would like to know, anybody able to assist with this?

Hi @M_LUY, welcome to the Streamlit community!

It’s the same answer as I gave last time. Tk is a desktop GUI. When you host an app anywhere but your local machine, you are not able to access that server’s desktop, just the information displayed through the browser. So the only workaround is to use something other than Tk to create your popup and have that information be passed through the browser.

Hi @randyzwitch thanks for your response
I cannot recall anybody responding previously but I might have missed it Do you have any suggestions what GUI works with Streamlit to display simple 2D moving objects? Its acctually this python library we want to run on Streamlit : , its a (Python) Discrete Event Simulation library that supports 2D animations which run on a Tkinter canvas and we would really like to make this work in Streamlit

Thanks very much
Michiel Luijken

I don’t know anything about this domain, but from their documentation, it appears that generating videos is a possibility. If so, you could possibly create a video, then use the provided to display the video:

1 Like

Thanks Randy (e.o),
I think you are correct, this is probably the only solution.

I initially ran into the issue that Streamlit needs H264 codec but with a work around I managed to run a simple demo animation as a video when running it my own browser (even though still got an error message with fall back solution at the command prompt.

But deploying it on Streamlit is not working it gives an error and now I am really stuck.

I have attached below links

Would you be able to assist? , does Streamlit accept other video formats? I tried .avi but that failed.

Thanks very much

Error message streamlit local (with fallback solution to still run): Dropbox - Error message Streamlit local.txt - Simplify your life

Errorlog Streamlit

Python file

I just found a way to at least show and deploy the app now with the animation as a animated gif following this thread: How to show local gif image? - #4 by randyzwitch , however video still has my preference (by far!!) but just in case we cannot get it to work…

Kind regards

Remember that streamlit actually comes with a built-in screen recorder, accessible from the burger menu top right when viewing an app. This can be used to record anything on screen - it doesn’t have to be the actual streamlit app itself.

And then just display as a video, per the above suggestion.

Sadly this can’t then be interactive, of course.