PyMOLWiki:Community Portal: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Reverted edit of 2chemp, changed back to last version by Inchoate) |
||
Line 18: | Line 18: | ||
Now with line numbers (or not)! | Now with line numbers (or not)! | ||
<npython> | <npython> | ||
# axes.py | # axes.py |
Revision as of 20:09, 14 November 2005
CP
Look here for ways to get involved in the PyMolWiki! Editors, you can upload images for your examples and supporting text! Check out Special:Upload.
If you feel like getting involved, we need folks to
- edit entries (hit the "Random Page" link and make sure it's correct.)
- add scripts
- add examples for commands
New! GeShi: Syntax Highlighting for Python & More
Update: I have added the option for numbered syntax highlighting and non-numbered.
<source lang="python">Non line-numbered code here</source>
<npython>line-numbered code here</npython>
Now with line numbers (or not)!
<npython>
- axes.py
from pymol.cgo import * from pymol import cmd from pymol.vfont import plain
- create the axes object, draw axes with cylinders coloured red, green,
- blue for X, Y and Z
obj = [
CYLINDER, 0., 0., 0., 50., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0., CYLINDER, 0., 0., 0., 0., 50., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0., CYLINDER, 0., 0., 0., 0., 0., 50., 0.2, 1.0, 1.0, 1.0, 0., 0.0, 1.0, ]
- add labels to axes object (requires pymol version 0.8 or greater, I
- believe
cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]]) cyl_text(obj,plain,[50.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]]) cyl_text(obj,plain,[0.,50.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]]) cyl_text(obj,plain,[0.,0.,50.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
- then we load it into PyMOL
cmd.load_cgo(obj,'axes') </npython>