-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcef_gui.py
28 lines (22 loc) · 849 Bytes
/
cef_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from cefpython3 import cefpython as cef
import platform
import sys
import json
def run_cef_gui(url_target, title):
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url=url_target,
window_title=title)
cef.MessageLoop()
cef.Shutdown()
def check_versions():
print("[cef_gui.py] CEF Python {ver}".format(ver=cef.__version__))
print("[cef_gui.py] Python {ver} {arch}".format(
ver=platform.python_version(), arch=platform.architecture()[0]))
assert cef.__version__ >= "55.3", "CEF Python v55.3+ required to run this"
if __name__ == '__main__':
if len(sys.argv) > 1:
run_cef_gui("localhost:5000/" + sys.argv[1], "GAOnline")
else:
run_cef_gui("localhost:5000/" , "GAOnline")