Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
How to click a Button automatically with Javascript from Python using Js2py

I am using eel in order to connect the frontent(HTML,CSS and JS) and backend with Python.

I want to click the button element automatically when a if condition states to true in python.

As far as I've searched I came across Js2py to be the easiest yet it doesn't seem to work with button clicking event.

The code that I tried

js='function $fine(){document.getElementById("spl").live("click");}'
ok=js2py.eval_js(js)
ok()

Error that I got:

raise MakeError('ReferenceError', '%s is not defined' % prop) js2py.internals.simplex.JsException: ReferenceError: document is not defined

Note: The if condition that I am checking for is

if not mixer.music.get_busy()

Basically a Music player project using Pygame, the need to click the play button in order to start the next song once the current song has completed playing. I have used eel in order to get functions from python to Javascript but now I want to get Javascript functions to python without using Flask. Any suggestions would be really helpful.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

UPDATE Js2Py Not working hence I tried to solve the same using Eel and faced another error as stated here but managed to solve it by doing as stated here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!