Make web browser-based desktop apps using python
Tkinter is pretty popular for making quick and functional GUI’s in python and it is fairly easy to use and learn. But, Tkinter is pretty limited in making advanced widgets and good UI.
To make advanced GUI one can use browser-based desktop apps just like discord to get the advanced widgets and functions without compromising the UI.
Neutron is a project which allows you to create native desktop apps using python. It gives full control of the DOM elements by using pywebview library.
You can check out the project at Neutron on github.
The installation is straight forward, you can install by running the command
pip install Neutron-Web
If you are getting an error while installation it’s because of Neutron’s pywebview dependency.
Note: Currently pywebview is only available for python 3.8 and older versions.
you can check your python version using the command in the windows powershell :
You can download the python 3.8 version from the python.org website. I used conda to manage python environment with different python versions.
Once you are done with cloning the project and you have python 3.8 installed on your PC. we are good to go and make our first desktop app using python.
Desktop App in python
To start with, you must know since the Neutron package is not installed using pip it cannot be accesed globally, you must have the “Neutron module folder” in the directory of where you save your main program.
To make simpler a “TEMPLATE” folder is present in the repo you cloned. Copy the Neuton folder in the “TEMPLATE” folder to run the sample desktop app provided by the developer.
Run the main.py program in the Template folder and you will see a loding window and then the sample desktop app with “Hello, text box and a button appeard”.
One step forward, Just like any othe web app you can change design make webpage/ app using HTML and CSS. The “render” file is the HTML file nad “def” is the CSS file.
Although, the developer explicitly says its not recommended for big projects, it is still pretty useful and an alternative for Tkinter.
If you made and interface using neutron leave its github link in the comments.