()
| 31 | |
| 32 | |
| 33 | def 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 | |
| 81 | def command_line_args(): |
no test coverage detected