> From: Peter Haebel [mailto:p.haebel@...]
> anyway, playing around I realised that it would be nice to be=20
> able to read
> out the pymol settings, such as 'bg_color', 'antialias' and any other
> variables. is there such a pymol function?
For well defined settings, this can be easily done, although the API is
somewhat incomplete.
(in python)
from pymol import cmd
print cmd.get_setting_tuple('bg_rgb')
my_variable =3D cmd.get_setting_tuple('antialias')
etc.
You will get a tuple of length 2. The first field is a type identifier,
and the second is the value corresponding to the setting. =20
Current type identifiers: 3 for a float, 4 for a nested tuple of three
floats. In the future, 1 will be a boolean, and 2 will be an int. =20
Settings are still in the process of being de-homogenized from being
pure floating point values. Eventually we will supplement this function
with something more descriptive and user-friendly -- it only exists this
early because I needed it to support the first external GUI.
Please contribute your extension for inclusion in util.py when it is
done.
Note that you can use cmd.extend to bind it to a command for maximum
convenience.=20
Cheers,
Warren
--
mailto:warren@...
Warren L. DeLano, Ph.D.
Informatics Scientist
Sunesis Pharmaceuticals, Inc.
341 Oyster Point Blvd.
S. San Francisco, CA 94080
(650)-266-3606 fax: (650)-266-3501
> -----Original Message-----
> From: Peter Haebel [mailto:p.haebel@...]
> Sent: Wednesday, October 24, 2001 1:12 PM
> To: pymol-users@...
> Subject: [PyMOL] Re: PyMOL-users digest, Vol 1 #2 - 2 msgs
>=20
>=20
> Hi Warren,
>=20
> I have a related question. just wrote a little extension for=20
> pymol that
> generates stereo figures and merges the right and left stereo image to
> complete the figure.
>=20
> util.stpng(["filename"]).
>=20
> the extension is written in python and uses PIL (the python=20
> image library)
> to manipulate the images. It can output the merged figures in=20
> all standard
> image formats (png, tiff, jpeg, ps, pdf, etc only depends on=20
> the libraries
> you have installed) and derives the format from the extension of the=20
> output filename.
>=20
> anyway, playing around I realised that it would be nice to be=20
> able to read
> out the pymol settings, such as 'bg_color', 'antialias' and any other
> variables. is there such a pymol function?
>=20
> cheers
>=20

Welcome everybody to the PyMOL mailing list. There are over 30
subscribers. I am very pleased that so many people want to use (and
thereby improve) the package.
> From: Ben Cornett=20
> Does anyone know how to get the size (pixels) of the viewer? I'd like
> to be able to write a python script that orients and colors a molecule
> and then renders it at whatever dpi I provide as a command-line
> argument.
Ben,
Hmm, not all of those features may exist yet, but the following will
help.
The "viewport" command can be used to change the window size.
Alternatively, the "ray" command can take width and height arguments.
Remember that two options exist for scripting: PyMOL commands and
Python. The former is easier for quick-and-dirty tasks.
# SCRIPT fig1.pml (PyMOL command language)
# RUN AS "pymol -c fig1.pml"
viewport 1024,768
load example.pdb
color marine
orient
ray=20
png fig1.png
# END
versus=20
# SCRIPT fig2.py (Python)
# RUN AS "pymol -c fig2.py"
from pymol import cmd
cmd.viewport(1024,768)
cmd.load("example.pdb")
cmd.color("marine")
cmd.orient()
cmd.ray()
cmd.png("fig2.png")
# END
also equivalent to=20
# SCRIPT fig3.pml (PyMOL)
# RUN AS "pymol -c fig3.pml"
load example.pdb
color marine
orient
ray 1024,768
png fig3.png
# END
Passing additional command arguments can't yet be done reliably, but you
might try playing around with -d (at least on unix). Note single quotes
and no spaces within the quote.
pymol -d 'w=3D1024;h=3D768'
should define "w" and "h" in the interpreter namespace.
Thus, the following works...
# SCRIPT fig3.py (Python)
# RUN AS "pymol -c -d 'w=3D1024;h=3D768' fig3.py "
from pymol import cmd
cmd.load("example.pdb")
cmd.color("marine")
cmd.orient()
cmd.ray(w,h)
cmd.png("fig3.png")
# END
You might even be able to pass in the input and output filenames:
pymol -c -d 'w=3D1024;h=3D768;i=3Dexample.pdb;o=3Dfig4.png' fig4.py
# SCRIPT fig4.py (Python)
from pymol import cmd
cmd.load(i)
cmd.color("marine")
cmd.orient()
cmd.ray(w,h)
cmd.png(o)
# END
- Warren

Does anyone know how to get the size (pixels) of the viewer? I'd like
to be able to write a python script that orients and colors a molecule
and then renders it at whatever dpi I provide as a command-line
argument.
Best,
Ben