Hi Lou,

You should be able to run commands by doing something like:

```python
from chimerax.core.commands import run

run(session, "view /coolChain:coolResidue", log=True)
```

Best,
Tom


From: "ChimeraX Users Help" <chimerax-users@cgl.ucsf.edu>
To: "ChimeraX Users Help" <chimerax-users@cgl.ucsf.edu>
Sent: Tuesday, 18 February, 2025 14:09:49
Subject: [chimerax-users] Re: Bundle development for chimeraX - svg onClick event to run command from QWebEngineView

Apologies, just realised I should have sent this to the developer mailing list. I'll do so now.

On Tue, 18 Feb 2025, 12:03 Lou Holland, <lou.holland@york.ac.uk> wrote:
Hello,

Apologies if this is the wrong email address to contact about this. I am currently working on a privateer bundle for carbohydrate validation in chimeraX. At present, I have it so that the privateer tool will display SNFGs of glycans present in the structure using svgs displayed in a QWebEngineView(). 

I would like, if possible, on clicking elements of the svg to run a chimeraX command (view /chainID:resID) to centre the view window on the residue in question. At present, I can implement an onClick event to display the command that should be run, but haven't managed to figure out how to just run the command from within that QWebEngineView. Is there a mechanism already in place for doing something like this that I could take advantage of? 

I'd considered using the "log html" to display the svgs in the log instead of the WebEngineView() so that I could take advantage of the href="cxcmd" functionality, but the svgs are long, with semicolons and new-line characters which interfere with this.

Best wishes,
Lou Holland
(Pronouns: they/them)

Research Associate
York Structural Biology Laboratory, 
Department of Chemistry,
University of York, 
Heslington, YO10 5DD, 
York, UK

_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/