How to use the eel.start 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 shadowmoose / RedditDownloader / redditdownloader / interfaces / eelwrapper.py View on Github external
return False
	browser = settings.get('interface.browser').lower().strip()
	browser = None if (browser == 'off') else browser
	options = {
		'app_mode': '-app' in browser if browser else None,
		'mode': browser.replace('-app', '') if browser else None,
		'host': settings.get('interface.host'),
		'port': settings.get('interface.port'),
		'block': False,
		'close_callback': _websocket_close,
		'all_interfaces': False,
		# 'app': btl.default_app()
	}

	eel.init(web_dir)
	eel.start('index.html', **options)
	print('Started WebUI!')
	if browser:
		print('Awaiting connection from browser...')
	else:
		print('Browser auto-opening is disabled! Please open a browser to http://%s:%s/index.html !' %
			  (options['host'], options['port']))
	started = True
	return True
github samuelhwilliams / Eel / examples / 08 - disable_cache / disable_cache.py View on Github external
import eel

# Set web files folder and optionally specify which file types to check for eel.expose()
eel.init('web')

# disable_cache now defaults to True so this isn't strictly necessary. Set it to False to enable caching.
eel.start('disable_cache.html', size=(300, 200), disable_cache=True)    # Start
github samuelhwilliams / Eel / examples / 04 - file_access / file_access.py View on Github external
import eel, os, random

eel.init('web')

@eel.expose
def pick_file(folder):
    if os.path.isdir(folder):
        return random.choice(os.listdir(folder))
    else:
        return 'Not valid folder'

eel.start('file_access.html', size=(320, 120))
github georgegach / flowiz / flowiz / gui / __main__.py View on Github external
u = save_image(uv[...,0], payload['name']+'.u', cmap='binary')
    v = save_image(uv[...,1], payload['name']+'.v', cmap='binary')
    return rgb, u, v


def create_or_clean_tempfolder(folpath):
    if os.path.exists(folpath):
        shutil.rmtree(folpath)
    os.mkdir(folpath)


if __name__ == '__main__':
    create_or_clean_tempfolder(savedir)
    print('> GUI webpath:', os.path.join(os.path.dirname(__file__), 'web'))
    eel.init(os.path.join(os.path.dirname(__file__), 'web'))
    eel.start('index.html', options={
        'chromeFlags': ['--disable-http-cache']})
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
# 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 / 02 - callbacks / callbacks.py View on Github external
eel.init('web')

@eel.expose
def py_random():
    return random.random()

def print_num(n):
    print('Got this from Javascript:', n)

# Call Javascript function, and pass explicit callback function    
eel.js_random()(print_num)

# Do the same with an inline callback
eel.js_random()(lambda n: print('Got this from Javascript:', n))

eel.start('callbacks.html', size=(400, 300))
github samuelhwilliams / Eel / examples / 07 - CreateReactApp / eel_CRA.py View on Github external
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 ThoughtfulDev / SupergirlOnCrypt / App / GUI.py View on Github external
def show():
    web_app_options = {
	'mode': "chrome-app",
	'port': 1337,
    'chromeFlags': [" --incognito"]
    }
    try:
        eel.start('ui.html', size=(1152,648), options=web_app_options)
    except EnvironmentError:
        web_app_options = {
	        'mode': "l33t",
	        'port': 1337
        }
        eel.start('ui.html', size=(1152,648), options=web_app_options)
github brentvollebregt / auto-py-to-exe / auto_py_to_exe / __main__.py View on Github external
def run(read_arguments=True):
    """ Open the interface """
    if read_arguments:
        check_arguments()
    cs.start()

    try:
        chrome_instance_path = eel.chrome.find_path()
        if chrome_instance_path is not None and os.path.exists(chrome_instance_path) and not disable_chrome:
            eel.start('main.html', size=(650, 612), port=0)
        else:
            eel.start('main.html', size=(650, 612), port=0, mode='user selection')
    except (SystemExit, KeyboardInterrupt):
        pass # This is what the bottle server raises

    shutil.rmtree(temporary_directory)