python-eel/Eel

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

Open

#491 aberto em 31 de mai. de 2021

Ver no GitHub
 (6 comments) (0 reactions) (0 assignees)Python (570 forks)batch import
help wanted

Métricas do repositório

Stars
 (5.980 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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

Guia do colaborador