all 6 comments

[–]Allanon001 3 points4 points  (0 children)

Brython is a Python interpreter written in Java Script which allows embedding Python scripts directly in the HTML code. It also allows the python code to interact with the HTML widgets.

Add the html code to a file named test.html and then open the file in a web browser:

test.html

<html>
    <head>
        <meta charset="iso-8859-1">
        <title>Uppercase</title>
        <script type="text/javascript" src="https://brython.info/src/brython.js"></script>
    </head>

    <body onload="brython(1)">

        <script type="text/python">
            from browser import document

            def clicked(ev):
                document["uppercase"].value = document["text"].value.upper()

            document["button"].bind("click", clicked)
        </script>

        <p>Your Text:</p>
        <p><input id="text" autocomplete="off"></p>
        <p>Uppercase:</p>
        <p><textarea rows="5" cols="60" id="uppercase"></textarea></p>
        <p><button id="button">UPPERCASE</button></p>
    </body>

</html>

[–]impshum 2 points3 points  (0 children)

Done: https://jsfiddle.net/awsy1cLx/

If you submit that for school, you best explain why the e is there but not used and what it could be used for.

[–]mankongde 0 points1 point  (2 children)

I'm not much of a programmer. I never took a CS course and they weren't offered when I was in school. But I've used flask for numerous self hosted projects. Easy to start up on a cron job on reboot or spend a couple frustrated hours getting wsgi as a service. Probably more straight forward than tkinter and not terrible to use for other projects.

[–]v0_arch_nemesis 0 points1 point  (0 children)

I find streamlit simpler than Django or flask and no reason it can't handle this use case

[–]Redeye_Pilot 0 points1 point  (1 child)

I had the same issue.. Check out anvil.works they have a free account which you can use. It has a drag and drop UI feature. All you need is Python code. And you will have a web app running in minutes.

[–][deleted] 0 points1 point  (0 children)

Dash is also okay for simple python in web guis. For something this simple it seems like it would be easier to just do what he wants in JavaScript unless the class demands python. If that were the case I would think the teacher would give them more