Ticket #684: testchanges.py
| File testchanges.py, 407 bytes (added by , 9 years ago) |
|---|
| Line | |
|---|---|
| 1 | # Example of how to detect when Atom display states change. |
| 2 | |
| 3 | def got_changes(trigger_name, changes): |
| 4 | print ('atom change reasons', changes.atom_reasons()) # List of strings, e.g. ['display changed'] |
| 5 | atoms = changes.modified_atoms() # Atoms object |
| 6 | print ('modified atoms', len(atoms)) |
| 7 | |
| 8 | from chimerax.core.atomic import get_triggers |
| 9 | t = get_triggers(session) |
| 10 | t.add_handler('changes', got_changes) |