python-eel/Eel

How to use eel with electron using mode='electron'?

Open

#491 ouverte le 31 mai 2021

Voir sur GitHub
 (6 commentaires) (0 réactions) (0 assignés)Python (570 forks)batch import
help wanted

Métriques du dépôt

Stars
 (5 980 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Hello!! I only have very little knowledge about node.js, so I could not use electron. But eel seems pretty easy to get started with. My system only has firefox installed, so the program I wrote didn't run initially. And although using mode = 'chrome-app' allowed me to run the app, it opens as a new tab on my browser. I was going through the documentation just now, and I saw the following line that really got me excited:

mode, a string specifying what browser to use (e.g. 'chrome', 'electron', 'edge', 'custom'). Can also be None or False to not open a window. Default: 'chrome'

So, I installed electron using npm and wrote the following dummy code to check if it works.

import eel
PORT = 8001

eel.init("./static")

@eel.expose
def print_booking_status(x, date):
    if(x==True):
        print(f"Booked Successfully for date {date}")
    else:
        print("Booking Cancelled");

eel.start("index.html", mode='electron', port=PORT)

But I'm getting an error that says electron installation was not found.

OSError: Can't find Electron installation

I also tried a global installation of electron, but it still didn't work. Can anyone provide any suggestions to run my code through electron? And is it even possible?

  • I know that if I don't provide a sample code that allows someone to quickly step into my shoes, I may not get the help I want or my issue may be closed.

Desktop (please complete the following information):

  • OS: GNU Linux (Pop!_OS)
  • Browser: Firefox
  • Version: 88.0.1

Guide contributeur