I am creating a GUI using Python Eel.
In this UI I have a drop down. user will select the value of dropdown and submit and that dropdown value will reflect in Python console.
But I am unable to receive value from JavaScript.
This is my Python code:
from random import randint
import eel
eel.init("web")
# Exposing the random_python function to javascript
@eel.expose
def random_python():
print("Random function running")
return randint(1,100)
@eel.expose
def getList():
lst = ["a","b","c","d"]
return lst
eel.spawn(eel.js_myval()())
eel.start("index.html")
This is my JavaScript:
let lst =document.getElementById("cate")
document.getElementById("submit").addEventListener("click",()=>{
eel.expose(js_myval)// here i am using eel expose
function js_myval(){
return lst.value;
}
})
This is my html:
<select name="meesho_category" id="cate">
<option value="x">x</option>
<option value="x">a</option>
<option value="x">b</option>
</select>