.. include:: headings.inc .. module:: lib.wxcairo .. currentmodule:: lib.wxcairo .. highlight:: python .. _lib.wxcairo: ========================================================================================================================================== |phoenix_title| **wxcairo** ========================================================================================================================================== This module provides some glue code that allows the pycairo package to be used for drawing direclty on wx.DCs. In cairo terms, the DC is the drawing surface. The `CairoContextFromDC` function in this module will return an instance of the pycairo Context class that is ready for drawing, using the native cairo surface type for the current platform. This module requires the pycairo pacakge, and makes use of ctypes for fetching the pycairo C API and also for digging into the cairo library itself. 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 pycairo are installed. On Mac you can get Cairo from MacPorts or Fink. If you are also using MacPorts or Fink for your Python installation then you should be able to get pycairo the same way. Otherwise it's real easy to build and install pycairo for the Python framework installation. Just get the source tarball from http://pypi.python.org/pypi/pycairo and do the normal 'python setup.py install' dance. On Windows you can get a Cairo DLL from here: http://www.gtk.org/download/win32.php You'll also want to get the zlib and libpng binaries from the same page. Once you get those files extract the DLLs from each of the zip files and copy them to some place on your PATH. Finally, there is an installer for the pycairo pacakge here: http://wxpython.org/cairo/ | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for module **wxcairo** .. raw:: html

Inheritance diagram of wxcairo

| |function_summary| Functions Summary ==================================== ================================================================================ ================================================================================ :func:`~lib.wxcairo.BitmapFromImageSurface` Create a wx.Bitmap from a Cairo ImageSurface. :func:`~lib.wxcairo.ContextFromDC` Creates and returns a Cairo context object using the wxDC as the :func:`~lib.wxcairo.FontFaceFromFont` Creates and returns a cairo.FontFace object from the native :func:`~lib.wxcairo.ImageSurfaceFromBitmap` Create an ImageSurface from a wx.Bitmap :func:`~lib.wxcairo.voidp` Convert a SWIGged void* type to a ctypes c_void_p ================================================================================ ================================================================================ | |class_summary| Classes Summary =============================== ================================================================================ ================================================================================ :ref:`lib.wxcairo.Pycairo_CAPI` ================================================================================ ================================================================================ | .. toctree:: :maxdepth: 1 :hidden: lib.wxcairo.Pycairo_CAPI Functions ------------ .. function:: BitmapFromImageSurface(surface) Create a wx.Bitmap from a Cairo ImageSurface. .. function:: ContextFromDC(dc) Creates and returns a Cairo context object using the wxDC as the surface. (Only window, client, paint and memory DC's are allowed at this time.) .. function:: FontFaceFromFont(font) Creates and returns a cairo.FontFace object from the native information in a wx.Font. .. function:: ImageSurfaceFromBitmap(bitmap) Create an ImageSurface from a wx.Bitmap .. function:: voidp(ptr) Convert a SWIGged void* type to a ctypes c_void_p