Selection Exists

From PyMOLWiki
Revision as of 11:10, 23 February 2005 by Krother (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#
# The function below will return true if the selection is defined.
#
from pymol import cmd
from types import *

def sele_exists(sele):
    sess = cmd.get_session()
    for i in sess["names"]:
        if type(i) is ListType:
            if sele==i[0]:
                return 1
    return 0