How to show tkinter output in webpage in python

Question:


how to show tkinter output on a webpage in python

code snippet
1 Like

You might have to use a Python - HTML library, or just use HTML and build a scalable window system.

2 Likes

Not even sure you can as tk was meant for GUI of desktop apps.

4 Likes

You can embed your repl by following these docs: https://docs.replit.com/hosting/embedding-repls. Otherwise, you could probably redirect visual data to a websocket and render it client-side.

3 Likes

This is definitely a first, why would you want to show a GUI output in HTML.

2 Likes

I’m creating an online python compiler so I can not show tkinter output on the webpage

1 Like

You need to use something else as the GUI on the browser has to be html not Tk. Tk is not for web pages but traditional apps.

2 Likes

You’d better off trying to use javascript’s canvas and/or some 2d javascript library

Replit does this so it is possible. However the others are right it’s not an easy thing to try.

3 Likes

You could try CloudTk. This will run an X11 app on a Linux host running VNC and display it via noVNC in a web browser. Check out the CloudTk at

CloudTk and for examples of Tcl/Tk apps (which could be any X11 app as all the examples are run in Docker Containers) go to Showcase

TK is (or at least was till i was active on replit that is almost a year go) a pain and terribly slow …

you can not get tkinter output in a webpage bcz it is a gui for apps