How to use the eel.say_hello_js function in Eel

To help you get started, we’ve selected a few Eel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github samuelhwilliams / Eel / examples / 05 - input / script.py View on Github external
from __future__ import print_function	# For Py2/3 compatibility
import eel

eel.init('web')                     # Give folder containing web files

@eel.expose                         # Expose this function to Javascript
def handleinput(x):
    print('%s' % x)

eel.say_hello_js('connected!')   # Call a Javascript function

eel.start('main.html', size=(500, 200))    # Start
github samuelhwilliams / Eel / examples / 07 - CreateReactApp / eel_CRA.py View on Github external
if develop:
        directory = 'src'
        app = None
        page = {'port': 3000}
        flags = ['--auto-open-devtools-for-tabs']
    else:
        directory = 'build'
        app = 'chrome-app'
        page = 'index.html'
        flags = []

    eel.init(directory, ['.tsx', '.ts', '.jsx', '.js', '.html'])

    # These will be queued until the first connection is made, but won't be repeated on a page reload
    say_hello_py('Python World!')
    eel.say_hello_js('Python World!')   # Call a JavaScript function (must be after `eel.init()`)

    eel.start(page, size=(1280, 800), options={
        'mode': app,
        'port': 8080,
        'host': 'localhost',
        'chromeFlags': flags
    })
github samuelhwilliams / Eel / examples / 06 - jinja_templates / hello.py View on Github external
import eel

eel.init('web/')                     # Give folder containing web files

@eel.expose                         # Expose this function to Javascript
def say_hello_py(x):
    print('Hello from %s' % x)

say_hello_py('Python World!')
eel.say_hello_js('Python World!')   # Call a Javascript function

eel.start('templates/hello.html', size=(300, 200), templates='templates')    # Start
github samuelhwilliams / Eel / examples / 01 - hello_world / hello.py View on Github external
from __future__ import print_function	# For Py2/3 compatibility
import eel

# Set web files folder
eel.init('web')

@eel.expose                         # Expose this function to Javascript
def say_hello_py(x):
    print('Hello from %s' % x)

say_hello_py('Python World!')
eel.say_hello_js('Python World!')   # Call a Javascript function

eel.start('hello.html', size=(300, 200))    # Start
github samuelhwilliams / Eel / examples / 01 - hello_world-Edge / hello.py View on Github external
import eel

# Use the same static files as the original Example
os.chdir(os.path.join('..', '01 - hello_world'))

# Set web files folder and optionally specify which file types to check for eel.expose()
eel.init('web', allowed_extensions=['.js', '.html'])


@eel.expose                         # Expose this function to Javascript
def say_hello_py(x):
    print('Hello from %s' % x)


say_hello_py('Python World!')
eel.say_hello_js('Python World!')   # Call a Javascript function

# Launch example in Microsoft Edge only on Windows 10 and above
if sys.platform in ['win32', 'win64'] and int(platform.release()) >= 10:
    eel.start('hello.html', mode='edge')
else:
    raise EnvironmentError('Error: System is not Windows 10 or above')
github samuelhwilliams / Eel / examples / 07 - CreateReactApp / eel_CRA.py View on Github external
def say_hello_py(x):
    # Print to Python console
    print('Hello from %s' % x)
    # Call a JavaScript function
    eel.say_hello_js('Python {from within say_hello_py()}!')