CEF Python
Table of contents:
Introduction
CEF Python is an open source project founded by Czarek Tomczak in 2012 to provide Python bindings for the Chromium Embedded Framework (CEF). The Chromium project focuses mainly on Google Chrome application development while CEF focuses on facilitating embedded browser use cases in third-party applications. Lots of applications use CEF control, there are more than 100 million CEF instances installed around the world. There are numerous use cases for CEF:
- Use it as a modern HTML5 based rendering engine that can act as
a replacement for classic desktop GUI frameworks. Think of it as Electron
for Python.
- Embed a web browser widget in a classic Qt / GTK / wxPython desktop
application
- Render web content off-screen in applications that use custom drawing
frameworks
- Use it for automated testing of web applications with more advanced
capabilities than Selenium web browser automation due to CEF low level
programming APIs
- Use it for web scraping, as a web crawler or other kind of internet bots
CEF Python also provides examples of embedding CEF for many Python GUI
frameworks such as PyQt, wxPython, PyGTK, PyGObject, Tkinter, Kivy, Panda3D,
PyGame, PyOpenGL, PyWin32, PySide and PySDL2.
Install
Command to install with pip:
pip install cefpython3==66.1
Hosted at pypi/cefpython3. On Linux pip 8.1+ is required.
You can also download packages for offline installation available on the GitHub Releases pages.
Below is a table with supported platforms, python versions and architectures.
OS | Py2 | Py3 | 32bit | 64bit | Requirements --- | --- | --- | --- | --- | --- Windows | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 / 3.9 | Yes | Yes | Windows 7+ (Note that Python 3.9 supports Windows 8.1+) Linux | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | Yes | Yes | Debian 8+, Ubuntu 14.04+,
Fedora 24+, openSUSE 13.3+ Mac | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | No | Yes | MacOS 10.9+
Examples
Support
- Ask questions and report problems on the
Forum
- Supported examples are listed in the
README-examples.md file
- Documentation is in the docs/ directory:
-
Build instructions
-
Contributing code
-
Knowledge Base
-
Migration guide
-
Tutorial
- API reference is in the api/ directory:
-
API categories
-
API index
- Additional documentation is available in
Issues labelled Knowledge Base
- To search documentation use GitHub "This repository" search
at the top. To narrow results to documentation only select
"Markdown" in the side pane
Support development
To support general CEF Python development efforts you can make a donation using PayPal button below:
Seeking sponsors
CEF Python is seeking companies to sponsor development of this project. Most important thing would be to have continuous monthly releases with updates to latest Chromium. There is also lots of cool features and new settings that would be nice to implement. We have not yet exposed all of upstream CEF APIs. If your company would like to sponsor CEF Python development efforts then please contact Czarek. There are no active sponsors at this moment.
Previous sponsors
API
Modules
* cefpython module
Settings
* ApplicationSettings dictionary * BrowserSettings dictionary * CommandLineSwitches dictionary
Classes and objects
* Browser object * Callback object * Cookie class * CookieManager class * DpiAware class (Win) * DragData object * Frame object * Image object * JavascriptBindings class * JavascriptCallback object * PaintBuffer object * Request class * Response object * WebPluginInfo object * WebRequest class * WindowInfo class * WindowUtils class
Client handlers (interfaces)
* AccessibilityHandler * DisplayHandler * DownloadHandler * FocusHandler * JavascriptDialogHandler * KeyboardHandler * LifespanHandler * LoadHandler * RenderHandler * RequestHandler * ResourceHandler * V8ContextHandler
Other interfaces
* CookieVisitor interface * StringVisitor interface * WebRequestClient interface
API index
*
_OnAccessibilityTreeChange
*
_OnAccessibilityLocationChange
*
acceptlanguage_list
*
appusermodel_id
*
auto_zooming
*
background_color
*
browsersubprocess_path
*
cache_path
*
commandlineargs_disabled
*
context_menu
*
downloads_enabled
*
externalmessage_pump
*
frameworkdir_path
*
ignorecertificate_errors
*
javascript_flags
*
locale
*
localesdir_path
*
debug
*
log_file
*
log_severity
*
multithreadedmessage_loop
*
netsecurityexpiration_enabled
*
packloading_disabled
*
persistsession_cookies
*
persistuser_preferences
*
product_version
*
remotedebugging_port
*
resourcesdir_path
*
single_process
*
string_encoding
*
uncaughtexceptionstack_size
*
uniquerequestcontextper_browser
*
user_agent
*
userdata_path
*
windowlessrendering_enabled
*
AddWordToDictionary
*
CanGoBack
*
CanGoForward
*
CloseBrowser
*
CloseDevTools
*
DragTargetDragEnter
*
DragTargetDragOver
*
DragTargetDragLeave
*
DragTargetDrop
*
DragSourceEndedAt
*
DragSourceSystemDragEnded
*
ExecuteFunction
*
ExecuteJavascript
*
Find
*
GetClientCallback
*
GetClientCallbacksDict
*
GetFocusedFrame
*
GetFrame
*
GetFrameByIdentifier
*
GetFrames
*
GetFrameCount
*
GetFrameIdentifiers
*
GetFrameNames
*
GetImage
*
GetJavascriptBindings
*
GetMainFrame
*
GetNSTextInputContext
*
GetOpenerWindowHandle
*
GetOuterWindowHandle
*
GetSetting
*
GetUrl
*
GetUserData
*
GetWindowHandle
*
GetIdentifier
*
GetZoomLevel
*
GoBack
*
GoForward
*
HandleKeyEventAfterTextInputClient
*
HandleKeyEventBeforeTextInputClient
*
HasDevTools
*
HasDocument
*
Invalidate
*
IsFullscreen
*
IsLoading
*
IsMouseCursorChangeDisabled
*
IsPopup
*
IsWindowRenderingDisabled
*
LoadUrl
*
Navigate
*
NotifyMoveOrResizeStarted
*
NotifyScreenInfoChanged
*
ParentWindowWillClose
*
Print
*
Reload
*
ReloadIgnoreCache
*
ReplaceMisspelling
*
SetAutoResizeEnabled
*
SetBounds
*
SendKeyEvent
*
SendMouseClickEvent
*
SendMouseMoveEvent
*
SendMouseWheelEvent
*
SendFocusEvent
*
SendCaptureLostEvent
*
SetAccessibilityState
*
SetClientCallback
*
SetClientHandler
*
SetFocus
*
SetMouseCursorChangeDisabled
*
SetJavascriptBindings
*
SetUserData
*
SetZoomLevel
*
ShowDevTools
*
StartDownload
*
StopLoad
*
StopFinding
*
ToggleFullscreen
*
TryCloseBrowser
*
WasResized
*
WasHidden
*
Font settings
*
acceptlanguage_list
*
applicationcache_disabled
*
background_color
*
databases_disabled
*
default_encoding
*
dompaste_disabled
*
fileaccessfromfileurls_allowed
*
inheritclienthandlersfor_popups
*
imageload_disabled
*
javascript_disabled
*
javascriptclosewindows_disallowed
*
javascriptaccessclipboard_disallowed
*
localstorage_disabled
*
plugins_disabled
*
remote_fonts
*
shrinkstandaloneimagesto_fit
*
tabtolinks_disabled
*
textarearesize_disabled
*
universalaccessfromfileurls_allowed
*
userstylesheet_location
*
websecurity_disabled
*
webgl_disabled
*
windowlessframe_rate
*
Continue
*
Cancel
*
CreateBrowser
*
CreateBrowserSync
*
ExceptHook
*
GetAppSetting
*
GetAppPath
*
GetBrowserByIdentifier
*
GetBrowserByWindowHandle
*
GetCommandLineSwitch
*
GetDataUrl
*
GetGlobalClientCallback
*
GetModuleDirectory
*
GetVersion
*
Initialize
*
IsThread
*
LoadCrlSetsFile
*
MessageLoop
*
MessageLoopWork
*
PostTask
*
PostDelayedTask
*
QuitMessageLoop
*
SetGlobalClientCallback
*
SetGlobalClientHandler
*
SetOsModalLoop
*
Shutdown
*
enable-media-stream
*
proxy-server
*
no-proxy-server
*
disable-gpu
*
Set
*
Get
*
SetName
*
GetName
*
SetValue
*
GetValue
*
SetDomain
*
GetDomain
*
SetPath
*
GetPath
*
SetSecure
*
GetSecure
*
SetHttpOnly
*
GetHttpOnly
*
SetCreation
*
GetCreation
*
SetLastAccess
*
GetLastAccess
*
SetHasExpires
*
GetHasExpires
*
SetExpires
*
GetExpires
*
GetGlobalManager
*
GetBlockingManager
*
CreateManager
*
SetSupportedSchemes
*
VisitAllCookies
*
VisitUrlCookies
*
SetCookie
*
DeleteCookies
*
SetStoragePath
*
FlushStore
*
Visit
*
OnAddressChange
*
OnAutoResize
*
OnConsoleMessage
*
OnLoadingProgressChange
*
OnStatusMessage
*
OnTitleChange
*
OnTooltip
*
CalculateWindowSize
*
EnableHighDpiSupport
*
GetSystemDpi
*
IsProcessDpiAware
*
SetProcessDpiAware
*
Scale
*
IsLink
*
IsFragment
*
GetLinkUrl
*
GetLinkTitle
*
GetFragmentText
*
GetFragmentHtml
*
GetImage
*
GetImageHotspot
*
HasImage
*
OnTakeFocus
*
OnSetFocus
*
OnGotFocus
*
Copy
*
Cut
*
Delete
*
ExecuteFunction
*
ExecuteJavascript
*
GetBrowser
*
GetParent
*
GetIdentifier
*
GetBrowserIdentifier
*
GetName
*
GetParent
*
GetSource
*
GetText
*
GetUrl
*
IsFocused
*
IsMain
*
IsValid
*
LoadString
*
LoadUrl
*
Paste
*
Redo
*
SelectAll
*
Undo
*
ViewSource
*
GetAsBitmap
*
GetAsPng
*
GetHeight
*
GetWidth
*
\\init\\_
*
IsValueAllowed
*
Rebind
*
SetFunction
*
SetObject
*
SetProperty
*
Call
*
GetFrame
*
GetId
*
GetFunctionName
*
Continue
*
OnJavascriptDialog
*
OnBeforeUnloadJavascriptDialog
*
OnResetJavascriptDialogState
*
OnJavascriptDialogClosed
*
OnPreKeyEvent
*
OnKeyEvent
*
DoClose
*
_OnAfterCreated
*
OnBeforeClose
*
OnBeforePopup
*
OnLoadingStateChange
*
OnLoadStart
*
OnDomReady
*
OnLoadEnd
*
OnLoadError
*
ERR_NONE
*
ERR_ABORTED
*
ERRACCESS_DENIED
*
ERRADDRESS_INVALID
*
ERRADDRESS_UNREACHABLE
*
ERRCACHE_MISS
*
ERRCERTAUTHORITY_INVALID
*
ERRCERTCOMMONNAME_INVALID
*
ERRCERTCONTAINS_ERRORS
*
ERRCERTDATE_INVALID
*
ERRCERT_END
*
ERRCERT_INVALID
*
ERRCERTNOREVOCATION_MECHANISM
*
ERRCERT_REVOKED
*
ERRCERTUNABLETOCHECK_REVOCATION
*
ERRCONNECTION_ABORTED
*
ERRCONNECTION_CLOSED
*
ERRCONNECTION_FAILED
*
ERRCONNECTION_REFUSED
*
ERRCONNECTION_RESET
*
ERRDISALLOWEDURL_SCHEME
*
ERREMPTY_RESPONSE
*
ERR_FAILED
*
ERRFILENOT_FOUND
*
ERRFILETOO_BIG
*
ERRINSECURE_RESPONSE
*
ERRINTERNET_DISCONNECTED
*
ERRINVALID_ARGUMENT
*
ERRINVALIDCHUNKED_ENCODING
*
ERRINVALID_HANDLE
*
ERRINVALID_RESPONSE
*
ERRINVALID_URL
*
ERRMETHODNOT_SUPPORTED
*
ERRNAMENOT_RESOLVED
*
ERRNOSSLVERSIONS_ENABLED
*
ERRNOT_IMPLEMENTED
*
ERRRESPONSEHEADERSTOO_BIG
*
ERRSSLCLIENTAUTHCERT_NEEDED
*
ERRSSLPROTOCOL_ERROR
*
ERRSSLRENEGOTIATION_REQUESTED
*
ERRSSLVERSIONORCIPHER_MISMATCH
*
ERRTIMED_OUT
*
ERRTOOMANY_REDIRECTS
*
ERRTUNNELCONNECTION_FAILED
*
ERR_UNEXPECTED
*
ERRUNEXPECTEDPROXY_AUTH
*
ERRUNKNOWNURL_SCHEME
*
ERRUNSAFE_PORT
*
ERRUNSAFE_REDIRECT
*
GetIntPointer
*
GetBytes
*
GetRootScreenRect
*
GetViewRect
*
GetScreenRect
*
GetScreenPoint
*
OnPopupShow
*
OnPopupSize
*
OnPaint
*
OnCursorChange
*
OnScrollOffsetChanged
*
OnTextSelectionChanged
*
StartDragging
*
UpdateDragCursor
*
CreateRequest
*
IsReadOnly
*
GetUrl
*
SetUrl
*
GetMethod
*
SetMethod
*
GetPostData
*
SetPostData
*
GetHeaderMap
*
GetHeaderMultimap
*
SetHeaderMap
*
SetHeaderMultimap
*
GetFlags
*
SetFlags
*
GetFirstPartyForCookies
*
SetFirstPartyForCookies
*
GetResourceType
*
GetTransitionType
*
CanGetCookies
*
CanSetCookie
*
GetAuthCredentials
*
GetCookieManager
*
GetResourceHandler
*
OnBeforeBrowse
*
_OnBeforePluginLoad
*
OnBeforeResourceLoad
*
_OnCertificateError
*
OnQuotaRequest
*
OnResourceRedirect
*
OnResourceResponse
*
OnPluginCrashed
*
OnProtocolExecution
*
OnRendererProcessTerminated
*
ProcessRequest
*
GetResponseHeaders
*
ReadResponse
*
CanGetCookie
*
CanSetCookie
*
Cancel
*
IsReadOnly
*
GetStatus
*
SetStatus
*
GetStatusText
*
SetStatusText
*
GetMimeType
*
SetMimeType
*
GetHeader
*
GetHeaderMap
*
GetHeaderMultimap
*
SetHeaderMap
*
SetHeaderMultimap
*
Visit
*
OnContextCreated
*
OnContextReleased
*
GetName
*
GetPath
*
GetVersion
*
GetDescription
*
Create
*
GetRequest
*
GetRequestStatus
*
GetRequestError
*
GetResponse
*
Cancel
*
OnUploadProgress
*
OnDownloadProgress
*
OnDownloadData
*
OnRequestComplete
*
SetAsChild
*
SetAsPopup
*
SetAsOffscreen
*
OnSetFocus
*
OnSize
*
OnEraseBackground
*
SetTitle
*
SetIcon
*
GetParentHandle
*
IsWindowHandle
*
gtkplug_new
*
gtkwidget_show
*
InstallX11ErrorHandlers