rdkit.sping.PIL.pidPIL module

pidPIL

This module implements a Python Imaging Library PIDDLE canvas. In other words, this is a PIDDLE backend that renders into a PIL Image object. From there, you can save as GIF, plot into another PIDDLE canvas, etc.

Joe Strout (joe@strout.net), 10/26/99 modified for use with sping. This requires Imaging to be installed as a package PIL

class rdkit.sping.PIL.pidPIL.PILCanvas(size=(300, 300), name='piddlePIL')

Bases: rdkit.sping.pid.Canvas

clear()
drawImage(image, x1, y1, x2=None, y2=None, **kwargs)

Draw a PIL Image into the specified rectangle. If x2 and y2 are omitted, they are calculated from the image size.

drawLine(x1, y1, x2, y2, color=None, width=None, dash=None, **kwargs)

Draw a straight line between x1,y1 and x2,y2.

drawPolygon(pointlist, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)

drawPolygon(pointlist) – draws a polygon pointlist: a list of (x,y) tuples defining vertices

drawString(s, x, y, font=None, color=None, angle=0, **kwargs)

Draw a string starting at location x,y.

fontAscent(font=None)

Find the ascent (height above base) of the given font.

fontDescent(font=None)

Find the descent (extent below base) of the given font.

getImage()
save(file=None, format=None)

format may be a string specifying a file extension corresponding to an image file format. Ex: ‘png’, ‘jpeg’, ‘gif’, ‘tif’ etc. These are defined by PIL, not by us so you need to check the docs. In general, I just specify an extension and let format default to None

stringWidth(s, font=None)

Return the logical width of the string if it were drawn in the current font (defaults to self.defaultFont).

rdkit.sping.PIL.pidPIL.test()
rdkit.sping.PIL.pidPIL.test2()
rdkit.sping.PIL.pidPIL.testit(canvas, s, x, y, font=None)