Table of contents:
Instructions to install the cefpython3 package, clone the repository and run the hello_world.py example:
pip install cefpython3==57.0
git clone https://github.com/cztomczak/cefpython.git
cd cefpython/examples/
python hello_world.py
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
- hello_world.py - Basic example, doesn't require any third party GUI framework to run
- tutorial.py - Example from Tutorial
- screenshot.py - Example of off-screen rendering mode to create a screenshot of a web page. The code from this example is discussed in great details in Tutorial in the Off-screen rendering section.
Embedding using various GUI frameworks
- gtk2.py: example for PyGTK library (GTK 2)
- gtk3.py: example for PyGObject / PyGI library (GTK 3). Currently broken on Mac (#310).
- pysdl2.py: off-screen rendering example for PySDL2 library. Currently tested only on Linux.
- pywin32.py: example for pywin32 library
- qt.py: example for PyQt4, PyQt5 and PySide libraries
- tkinter_.py: example for Tkinter. Currently broken on Mac (#309).
- wxpython.py: example for wxPython toolkit
Build executable using Python packagers
- PyInstaller example: example of packaging app using PyInstaller packager
Unit tests
There are also available unit tests and its usage of the API can be of some use. See main_test.py.
There are even more examples available, some of them are externally maintained.
- Kivy framework: see Kivy wiki page.
- Panda3D game engine: see Panda3D wiki page.
- PyGame/PyOpenGL: see gist by AnishN
- Example of implementing ResourceHandler with the use of WebRequest object and WebRequestClient interface to allow for reading/modifying web requests: see the wxpython-response.py example in the cefpython31 branch.
- Example of using Python network library (urllib3/openssl) instead of Chromium's network library - see gist by Massimiliano Dal Cero
There are ongoing efforts to add these examples to the official examples/ directory, see issues in the tracker.