I'm currently writing a simple GUI in html/python using eel. Unfortunatly, although having directly copied it from the official tutorial, i get the error "GET file:///C:/eel.js net::ERR_FILE_NOT_FOUND" when I'm trying to load eel.js. My header looks somethong like this:
<head>
<meta charset="utf-8">
<title>My eel GUI</title>
<script type="text/javascript" src="/eel.js"></script>
<script>
eel.expose(my_function)
function my_function(text) {
console.log("Hello!")
}
</script>
</head>
Thank you for your help.
My python file looks ike this:
import eel
class GUI:
def __init__(self):
eel.init("web")
eel.start("main.html", block = False)
eel.sleep(5)
Add @eel.expose on top of your init function. Something like this:
class GUI:
@eel.expose
def __init__(self):
eel.init("web")
eel.start("main.html", block=False)
eel.sleep(5)
def test_my_function(self):
eel.my_function()
x = GUI()
x.test_my_function()