run python code using html5 [closed]
Asked Answered
T

1

5

Basically I want to create a sexy GUI using HTML5 then call code that I wrote in python. I have just discovered some tutorials about web2py, however I am getting the videos now from youtube so I can only watch when I get home. (Life of a student with no internet at home).

So basically I have written a python script, now I want to use a webpage to interact with that script instead of terminal as I have been doing. So I have a webpage provide me the GUI to my python app.

Hope this makes more sense.

Any help and direction will be greatly appreciated.

Thanks in advance

Toothy answered 20/2, 2014 at 16:2 Comment(3)
I have never used web2py but Flask and Bottle are 2 frameworks that are pretty lightweight and easy to learn.Comity
Have you seen this page in the docs?Hangnail
Having a look now. Thank you!Toothy
V
9

You need to flip that around, you want to run server-side python code that renders your sexy HTML5 GUI. There are many Python frameworks that are suitable to this, including web2py, django, and my personal favorite flask.

Any of these frameworks will let your python code run, then render the HTML with python variables/functions available by using a templating engine (for example Flask uses Jinja template). Tutorials are readily available for all of these python libraries, but if you want to take a look at Flask, I can recommend Miguel Grinberg's excellent tutorial series.

Verjuice answered 20/2, 2014 at 16:9 Comment(2)
Thank you very much. Makes more sense now! Much appreciated.Toothy
@binaryatrocity, Why flask?Arrhenius

© 2022 - 2024 — McMap. All rights reserved.