Hi Vin,

I added something a long time ago which still seems to work: Draw.ShowMol:

In [3]: from rdkit.Chem import Draw


In [4]: Draw.ShowMol(m)



That, for me at least, opens a window with an image of the molecule. It's
using tkinter, so it should work on all three supported operating systems.

Unfortunately, at least on my machine, I have to close the window before
the ipython prompt becomes active again.

-greg


On Tue, Sep 1, 2020 at 3:59 PM Scalfani, Vincent <vfscalf...@ua.edu> wrote:

> Hello,
>
> Is it possible to display a molecule image directly in an IPython console
> (not a Jupyter Notebook)? Or maybe I need to send the image file directly
> to my image viewer? I would like to be able to quickly view the molecules
> without using a Jupyter Notebook or having to save the PNGs. For example:
>
> In [6]: from rdkit import Chem
>    ...: from rdkit.Chem.Draw import IPythonConsole
>    ...: from rdkit.Chem import Draw
>
>
> In [7]: m = Chem.MolFromSmiles('c1ncncc1C(=O)[O-]')
>
>
> In [8]: m
>
> Out[8]: <rdkit.Chem.rdchem.Mol at 0x....>
>
> In [9]: Chem.Draw.MolToImage(m)
>
> Out[9]: <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at
> 0x...>
>
>
> Thanks for your help.
>
> Vin
>
> ---
>
> Vincent F. Scalfani
> The University of Alabama
>
> <vfscalf...@ua.edu>
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to