Skip to content

Latest commit

 

History

History
160 lines (127 loc) · 7.17 KB

File metadata and controls

160 lines (127 loc) · 7.17 KB

Examples README

Table of contents:

Hello World!

Instructions to install the cefpython3 package, clone the repository and run the hello_world.py example:

pip install cefpython3==66.0
git clone https://github.com/cztomczak/cefpython.git
cd cefpython/examples/
python hello_world.py

Supported examples

Examples provided in the examples/ root directory are actively maintained. If there are any issues in examples read top comments in sources to see whether this is a known issue with available workarounds.

Featured

Snippets

See small code snippets that show various CEF features in the examples/snippets/ directory:

  • javascript_bindings.py - Communicate between Python and Javascript asynchronously using inter-process messaging with the use of Javascript Bindings.
  • javascript_errors.py - Two ways for intercepting Javascript errors.
  • mouse_clicks.py - Perform mouse clicks and mouse movements programmatically.
  • network_cookies.py - Implement interfaces to block or allow cookies over network requests.
  • onbeforeclose.py - Implement interface to execute custom code before browser window closes.
  • ondomready.py - Execute custom Python code on a web page as soon as DOM is ready.
  • onpagecomplete.py - Execute custom Python code on a web page when page loading is complete.

GUI frameworks

Examples of embedding CEF browser using various GUI frameworks:

Build executable with PyInstaller

Unit tests

There are also available unit tests and its usage of the API can be of some use. See:

Other examples

There are even more examples available, they do not reside in the examples/ directory. Some of them were created for old verions of CEF and were not yet ported to latest CEF. Some of them are externally maintained.

More examples to come

Here is a list of issues in the tracker to create or upgrade examples:

  • Issue #323 - "Create cocos2d example"
  • Issue #322 - "Create pyglet example"
  • Issue #312 - "Easy to use CefBrowser widgets for many popular GUI toolkits"
  • Issue #301 - "Fix cefpython3.wx package to work with latest v55+"
  • Issue #289 - "Pygame / PyOpenGL example"
  • Issue #288 - "Create panda3d_.py example"
  • Issue #285 - "[kivy_.py] Refactor example, make it work cross-platform and move it to examples/"
  • Issue #252 - "Use CEF views in Hello World, Tutorial and Offscreen examples, and in Unit tests"
  • Issue #224 - "Port CEF 1 examples to CEF 3"
  • Issue #109 - "The ResourceHandler example"

Packaging examples:

  • Issue #407 - "Example of packaging app using Cython compiler"
  • Issue #396 - "Example of packaging app using Nuitka compiler"
  • Issue #338 - "Example of packaging app using cx_Freeze"
  • Issue #337 - "Example of packaging app using py2app"
  • Issue #135 - "Example of packaging app using pyinstaller"