python-eel/Eel

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

Open

#491 建立於 2021年5月31日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)Python (570 fork)batch import
help wanted

倉庫指標

Star
 (5,980 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南