问题
Is there any way to run a python script that utilizes TKinter on a web page such that a user could run the script and interact with the TK windows without having to download the script or have the appropriate python interpreter?
回答1:
No. There is no way to do this.
回答2:
The only approach I can think of, is to use some virtual screen protocol such as VNC, run your Tkinter script on a server for that protocol (e.g., a VNC server), and use a viewer browser plug-in for that protocol in the user's browser (e.g., maybe this one -- haven't tried it myself, though). A similar approach could use the NX protocol (e.g., cfr here).
Note that such solutions will most likely not scale well: they're mostly meant to let one user connect to "their desktop" from a browser. Performance, robustness and scalability of web-native approaches will all run rapid circles around any such "compatibility hack"!
来源:https://stackoverflow.com/questions/3284779/any-way-to-run-python-tk-scripts-on-web-page