MCPcopy Create free account
hub / github.com/cztomczak/cefpython / main

Function main

examples/pywin32.py:33–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def main():
34 command_line_args()
35 check_versions()
36 sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
37
38 settings = {
39 "multi_threaded_message_loop": g_multi_threaded,
40 }
41 cef.Initialize(settings=settings)
42
43 window_proc = {
44 win32con.WM_CLOSE: close_window,
45 win32con.WM_DESTROY: exit_app,
46 win32con.WM_SIZE: WindowUtils.OnSize,
47 win32con.WM_SETFOCUS: WindowUtils.OnSetFocus,
48 win32con.WM_ERASEBKGND: WindowUtils.OnEraseBackground
49 }
50 window_handle = create_window(title="PyWin32 example",
51 class_name="pywin32.example",
52 width=800,
53 height=600,
54 window_proc=window_proc,
55 icon="resources/chromium.ico")
56
57 window_info = cef.WindowInfo()
58 window_info.SetAsChild(window_handle)
59
60 if g_multi_threaded:
61 # When using multi-threaded message loop, CEF's UI thread
62 # is no more application's main thread. In such case browser
63 # must be created using cef.PostTask function and CEF message
64 # loop must not be run explicitilly.
65 cef.PostTask(cef.TID_UI,
66 create_browser,
67 window_info,
68 {},
69 "https://www.google.com/")
70 win32gui.PumpMessages()
71
72 else:
73 create_browser(window_info=window_info,
74 settings={},
75 url="https://www.google.com/")
76 cef.MessageLoop()
77
78 cef.Shutdown()
79
80
81def command_line_args():

Callers 1

pywin32.pyFile · 0.70

Calls 6

create_windowFunction · 0.85
PostTaskMethod · 0.80
command_line_argsFunction · 0.70
check_versionsFunction · 0.70
create_browserFunction · 0.70
SetAsChildMethod · 0.45

Tested by

no test coverage detected