0

when Im calling the JS function through my python code with the eel.function()() it says "Cannot find reference 'function' in 'init.py'", it seems to be working fine in my teachers video. Here`s the python code:


eel.init('web')


def user_input():
    eel.get_ready()()

    while True:
        loading = int(input("[+] start loading? 1/0"))
        if loading == 1:
            eel.js_start_loading()()

        elif loading == 0:
            eel.js_stop_loading()()


eel.spawn(user_input())
eel.start('index.html', size=(850, 360), port=0)

Here`s the JS code:

    var progress = null;
    eel.expose(js_start_loading);
    function js_start_loading() {
        progress = Metro.activity.open({
            type: 'square',
            overlayColor: '#fff',
            overlayAlpha: 1,
            text: '<div class=\'mt-2 text-small\'>Please, wait...</div>
        });
    }

    eel.expose(js_stop_loading);
    function js_stop_loading() {
        Metro.activity.close(progress);
    }

   eel.expose(get_ready);
   function get_ready() {
       $(document).ready(function(){
           return true;
       });
   }

Would appreciate any help

Bruchel
  • 13
  • 2
  • Shouldn't it be `eel.spawn(user_input)`? – Axe319 Jan 06 '22 at 12:35
  • yea my bad, but still the python code doesnt work, like, it is opening the html window but then nothing – Bruchel Jan 06 '22 at 12:44
  • Are you able to provide a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)? The code provided thus far isn't a complete example (missing index.html, JS references 'Metro' which isn't defined, etc.). It's difficult to help out without being able to reproduce the exact error and investigate. – dstricks Jan 13 '22 at 02:14
  • This code fragment is not enough to learn and reproduce – ABDULLOKH MUKHAMMADJONOV Jan 13 '22 at 19:21

0 Answers0