Functions in the cefpython module.
Table of contents:
- Functions
- CreateBrowser
- CreateBrowserSync
- ExceptHook
- GetAppSetting
- GetAppPath
- GetBrowserByIdentifier
- GetBrowserByWindowHandle
- GetCommandLineSwitch
- GetDataUrl
- GetGlobalClientCallback
- GetModuleDirectory
- GetVersion
- Initialize
- IsThread
- LoadCrlSetsFile
- MessageLoop
- MessageLoopWork
- PostTask
- PostDelayedTask
- QuitMessageLoop
- SetGlobalClientCallback
- SetGlobalClientHandler
- SetOsModalLoop
- Shutdown
Not yet implemented - currently this method just calls CreateBrowserSync. In upstream CEF this method creates browser asynchronously. Currently CEF Python depends on browser being created synchronously in a few parts of code.
| Parameter | Type |
|---|---|
| window_info | WindowInfo |
| settings | BrowserSettings |
| url | string |
| window_title | string |
| Return | Browser |
All parameters are optional.
This function can only be called on the UI thread.
The "window_title" parameter will be used only when parent window provided in window_info was set to 0. This is for use with hello_world.py and tutorial.py examples which don't use any third party GUI framework for creation of top-level window.
After the call to CreateBrowserSync() the page is not yet loaded, if you want your next lines of code to do some stuff on the webpage you will have to implement LoadHandler.OnLoadingStateChange callback.
| Parameter | Type |
|---|---|
| exc_type | - |
| exc_value | - |
| exc_trace | - |
| Return | void |
Global except hook to exit app cleanly on error. CEF has a multiprocess architecture and when exiting you need to close all processes (main Browser process, Renderer process, GPU process, etc.) by calling Shutdown(). This hook does the following: in case of exception write it to the "error.log" file, display it to the console, shutdown CEF and exit application immediately by ignoring "finally" (_exit()).
See also Tutorial: Handling Python exceptions.
| Parameter | Type |
|---|---|
| key | string |
| Return | object |
Returns ApplicationSettings option that was passed to Initialize(). Returns None if key is not found.
| file_ (optional) | string |
| Return | string |
Get path to where application resides.
| Parameter | Type |
|---|---|
| identifier | int |
| Return | void |
Get browser by identifier. Browser identifier can be obtained by
calling Browser.GetIdentifier.
| Parameter | Type |
|---|---|
| windowHandle | long |
| Return | void |
Get browser by outer or inner window handle. An outer window handle is the one that was passed to CreateBrowserSync(). An inner window handle is a CEF internal window handle.
| Parameter | Type |
|---|---|
| key | string |
| Return | object |
Returns the CommandLineSwitches switch that was passed to Initialize(). Returns None if key is not found.
| Parameter | Type |
|---|---|
| data | string |
| mediatype="html" (optional) | string |
| Return | object |
Convert data to a Data URL. Only "html" media type is currently supported.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
| Parameter | Type |
|---|---|
| name | string |
| Return | object |
Returns a global client callback that was set using SetGlobalClientCallback() or SetGlobalClientHandler. Returns None if callback was not set.
| Return | string |
Get the cefpython module directory. This method is useful to get full path to CEF binaries. This is required when setting ApplicationSettings options like: 'browser_subprocess_path', 'resources_dir_pat' and 'locales_dir_path'.
| Return | dict |
Return CEF Python and CEF versions dictionary with keys:
- version
- chrome_version
- cef_version
- cef_api_hash_platform
- cef_api_hash_universal
- cef_commit_hash
- cef_commit_number