What is Brython?
After I became more curious about Brython, I learned more about Brython(Browser Python).
Whats is Brython(Browser Python)?
Brython supports most of the syntax of Python 3, including generators, metaclasses, imports, etc., and many modules of Python.
It supports the latest specs of HTML5/CSS3, and also you use CSS Frameworks like Bootstrap 3, LESS, SASS, etc.
How to install Brython?
You install Brython very easily help of pip and CDN.
pip install brython
Then create an empty folder/ directory and run the following command.
If Brython-cli does not work. then follow this command
python -m brython --install
Run the Web server app
Run webserver locally use of python.
python -m http.serverorpython -m http.server 8001
After some time, Brython launches the new version. You update Brython's with two commands.
pip install brython --upgrade
Now you start working on Brython.
You use Brython's help of CDN (Contact delivery network). You copy CDN links on the official Brython website. after paste links inside your HTML page.
<script src="https://firstname.lastname@example.org/brython.min.js"> </script> <script src="https://email@example.com/brython_stdlib.js"> </script>
Update your Brython. Just change CDN links on your site.
How to use Brython?
Use Brython very easily inside your project. follow all steps
- Firstly, install Brython help of CDN and npm.
- Secondly, Call the function
brython()on page load, like
- Write Python code inside script tags.
<body onload="brython()" > <script type="text/python"> # write python code here </script></body>
Hello World Example
In the Hello World example, you show hello world inside the dom.
Mouse Event Example
Mouse Event Example you understand the basics of event handling in Brython
In this Alert example, I Create an alert in the browser
Dialog box example
In this example, I create a dialog box in the browser use of python
Future of Brython
In my opinion, Brython's future is not clear. Every New Technology Coming with own thought. Brython Launch official Nav 22 2016.
After 4-year Brython did not create a big impact on the developers' community. Maybe in the future developer's mind change. The developer shows more interested in Brython.
You use Brython to handle the frontend and backend in one place. I think this feature is very cool for me.
If you hire me, then follow me on Upwork and Fiverr.