/electron-python-ex

Connecting Python 3 and Electron Example

Primary LanguageCSSMIT LicenseMIT

electron-py-ex

Connecting Python 3 and Electron with a simple example

Building

You'll need Node.js and Python 3 installed on your computer in order to run this app.

$ git clone https://github.com/cjadeveloper/electron-py-ex
$ cd electron-py-ex

Make sure that Python 3 is installed on your system

$ python -V
Python 3.8.5

Create a Python virtual environment in the same directory, activate and install dependencies

# Create a venv
$ python -m venv .venv
# Activate: Win: .venv\Scripts\activate.bat ; Linux bash: source .venv/bin/activate
$ source .venv/bin/activate
# install dependencies
$ (.venv) pip install -r requirements.txt

Note: If you know how some python dependency managers like poetry or pipenv (or whatever) works, you can use them instead of pip. I particularly use poetry. Anyway, I have shown how to install the dependencies with pip although I leave the pyproject.toml file for reference.

Install node dependencies and run

$ npm install
$ npm start

For Poetry users you can launch the app:

$ npm run dev