George,

On Tue, Jul 12, 2011 at 6:54 PM, George Papadatos <[email protected]> wrote:
> On a related topic, is it possible to depict an arbitrary string on a cairo
> canvas? I am thinking particularly depicting the name or ID of a molecule
> below its structure.

It's not there at the moment, but it's definitely possible. The
process would be similar to what I proposed to Peter. The additional
piece of information you'd need is that the MolDrawing instance also
has a boundingBoxes data member that is keyed by the molecule. You
could do something like this:

    from rdkit.Chem.Draw.MolDrawing import Font
    bbox = drawer.boundingBoxes[mol]
    pos = (bbox[2]-bbox[0])/2,bbox[3]
    font=Font(face='sans',size=12)
    canvas.addCanvasText(legend,pos,font)

(you'll almost definitely have to experiment a bit to get the text
placed correctly)

-greg

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to