phoenix_title wx.lib.wxcairo

This package provides some glue code that allows the Cairo library to draw directly on wx.DC objects, convert to/from wx.Bitmap objects, etc. using either the PyCairo or the newer cairocffi Cairo wrappers. In Cairo terms, the DC is the drawing surface. The CairoContextFromDC function in this module will return an instance of the Cairo Context class that is ready for drawing, using the native cairo surface type for the current platform.

Note

Be sure to import wx.lib.wxcairo before importing the cairo module.

To use Cairo with wxPython you will need to have a few dependencies installed. On Linux and other unix-like systems you may already have them, or can easily get them with your system’s package manager. Just check if libcairo and either cairocffi or pycairo packages are installed.

On Mac you can get Cairo from MacPorts or similar tools. Make sure that the quartz option is turned on so those Mac-specific APIs will be included in the Cairo library when it is built. You can then use pip install cairocffi to get the Python wrappers. If your cairo shared library is in a non-standard location, then you can help it be found by setting DYLD_FALLBACK_LIBRARY_PATH in the environment.

On Windows a copy of the Cairo and related DLLs are included with wxPython inside the wx package folder. These files were extracted from the GTK runtime installers found at the following URLs. You can replace those DLLs with others if you choose, or you can cause the wx_cairocffi module to use DLLs from some other location by setting the CAIRO environment variable.

function_summary Functions Summary

BitmapFromImageSurface

Create a wx.Bitmap from a Cairo ImageSurface.

ContextFromDC

Creates and returns a cairo.Context object using the wx.DC as

FontFaceFromFont

Creates and returns a cairo.FontFace object from the native

ImageSurfaceFromBitmap

Create a Cairo ImageSurface from a wx.Bitmap


Functions



BitmapFromImageSurface(surface)

Create a wx.Bitmap from a Cairo ImageSurface.



ContextFromDC(dc)

Creates and returns a cairo.Context object using the wx.DC as the surface. (Only window, client, paint and memory DC’s are allowed at this time.)



FontFaceFromFont(font)

Creates and returns a cairo.FontFace object from the native information in a wx.Font.



ImageSurfaceFromBitmap(bitmap)

Create a Cairo ImageSurface from a wx.Bitmap