Advertisement
stevetheimpact

Python Eel example

Jan 18th, 2021
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import eel
  4. import bottle as btl
  5. import os, platform, sys
  6.  
  7. def start():
  8.     eel.init('web')
  9.     try:
  10.         options = {
  11.             "host": 'localhost',
  12.             "port": 2800,
  13.             "position": None,
  14.             "size": (480,250),
  15.             "app_mode": True,
  16.             "mode": 'chrome',
  17.             "jinja_templates": None,
  18.             "block": True,
  19.             "close_callback": None,
  20.             "cmdline_args": [],
  21.         }
  22.         try:
  23.             eel.start('main.html', **options )
  24.         except (EnvironmentError, OSError):
  25.             if sys.platform in ['win32', 'win64'] and int(platform.release()) >= 10:
  26.                 options['mode'] = "edge"
  27.                 try:
  28.                     eel.start('main.html', **options)
  29.                 except (EnvironmentError, OSError):
  30.                     raise
  31.             else:
  32.                 raise
  33.     except (SystemExit, MemoryError, KeyboardInterrupt):
  34.         pass
  35.  
  36. if __name__ == '__main__':
  37.     start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement