How to use the eel.sleep 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 / 03 - sync_callbacks / sync_callbacks.py View on Github external
@eel.expose
def py_random():
    return random.random()

eel.start('sync_callbacks.html', block=False, size=(400, 300))

# Synchronous calls must happen after start() is called

# Get result returned synchronously by 
# passing nothing in second brackets
#                   v
n = eel.js_random()()
print('Got this from Javascript:', n)

while True:
    eel.sleep(1.0)
github shadowmoose / RedditDownloader / redditdownloader / interfaces / eelwrapper.py View on Github external
def _websocket_close(page, old_websockets):
	global stopped
	print('A WebUI just closed. Checking for other connections... (%s)[%s]' % (page, len(old_websockets)))
	for i in range(40):
		eel.sleep(.1)
		# noinspection PyProtectedMember
		if len(eel._websockets) > 0:
			print('Open connections still exist. Not stopping UI server.')
			return
	if not settings.get('interface.keep_open'):
		print('WebUI keep_open is disabled, and all open clients have closed. Exiting.')
		if _controller and _controller.is_alive():
			_controller.stop()
		stopped = True
	else:
		print('Keeping UI server open...')
github ChrisKnott / Algojammer / algojammer.py View on Github external
def run(code, stdin=''):
    while state['mode'] != 'stopped':
        state['mode'] = 'interrupt'
        eel.sleep(0.01)

    state['mode'] = 'running'
    sta.execution_start()
    exe.bounded_exec(code, 10**7, report)
    state['mode'] = 'stopped'
github shadowmoose / RedditDownloader / redditdownloader / interfaces / eelwrapper.py View on Github external
def display(self):
		if started:
			return False
		webdir = os.path.join(os.path.dirname(__file__), '../web/')
		start(web_dir=webdir)
		while not stopped:
			eel.sleep(1)