PythonTerminal

From PyMOLWiki
Jump to: navigation, search

PyMOL allows the execution of python commands from the PyMOL command line. It is very useful for both debugging, and for discovering new functions.

Examples

# there is no "print" command in PyMOL, so this will go to the python interpreter
print "Hello World (1)"
 
# same, but force it to be python
/print "Hello World (2)"
 
# no lets trick this system by introducing a PyMOL command named "print"
cmd.extend('print', lambda msg: sys.stdout.write("You gave me `%s`\n" % (msg)))
 
# see what happens
print "Hello World (3)"
 
# this will still go to the python interpreter
/print "Hello World (4)"
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox