Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to send data from dropdown in js back to python #702

Open
princebhatia09 opened this issue Jul 7, 2021 · 1 comment
Open

how to send data from dropdown in js back to python #702

princebhatia09 opened this issue Jul 7, 2021 · 1 comment

Comments

@princebhatia09
Copy link

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>
@almarklein
Copy link
Member

I am not sure how this question relates to Flexx. It looks like your code is only Eel and vanilla js/html. I am not familiar with Eel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants