
Hi Shubham, The atom names that popup when you hover over the mouse appear because the mousemode command has mode "identify object" assigned to the pause event. You can see the active mouse modes by typing the mousemode ChimeraX command: mousemode <help:user/commands/ui.html#mousemode>left: rotate control left: select middle: translate right: translate wheel: zoom pause: identify object and setting the pause mode is done using a command like mousemode pause "identify object" You could write some Python code to define a new mouse mode to do whatever you want. You can copy the current "identify object" mode Python code as a starting point. It is at the ChimeraX Github source repository here https://github.com/RBVI/ChimeraX/blob/7e0a20f26b0de02e63e7ff6a43bc227921aa52... In your ChimeraX distribution on Mac this file would be located here ChimeraX.app/Contents/lib/python3.9/site-packages/chimerax/mouse_modes/std_modes.py Looking at that "identify object" code I see it invokes triggers which can run other code, so you could leave the pause mousemode as "identify object" and just add some Python code that will do something when hovering in addition to the usual showing the atom name. Here is an example that logs the atom x,y,z position when you hover over it. def mouse_hover(trigger_name, pick): from chimerax.atomic import PickedAtom if isinstance(pick, PickedAtom): atom = pick.atom x,y,z = atom.scene_coord message = f'Atom %s position %.2f,%.2f,%.2f' % (str(atom), x, y, z) session.logger.status(message, log = True) session.triggers.add_handler('mouse hover', mouse_hover) I put this in a file hover.py and opened it in ChimeraX (command "open ~/hover.py") to register the mouse_hover() callback function. Opening that Python could be automatically done at ChimeraX startup using ChimeraX Preferences / Startup / Execute these commands at startup. Then hovering over an atom logs a message Atom /A ASN 72 ND2 position -15.70,-23.42,-0.77 Tom
On Jul 6, 2023, at 12:08 PM, Shubham Devesh Ramgoolam via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Elaine, Thank you for getting back to me. Actually, it would be more helpful if I were able to look at the code itself. Thanks again, Shubham From: Elaine Meng <meng@cgl.ucsf.edu> Sent: July 6, 2023 1:41 PM To: Shubham Devesh Ramgoolam <sdramgoolam@uwaterloo.ca> Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Subject: Re: [chimerax-users] Graphical Window
Hi Shubham, The user-interface (nonprogramming) way to do it is to Ctrl-click to select that item, then perform the task on the selection.
If you really need to look at the code, it may be very complicated, and somebody else would have to respond since I don't know the answer.
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jul 4, 2023, at 7:42 PM, Shubham Devesh Ramgoolam via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi all, I hope you are doing well. If I hover my mouse over a structure in the graphical window of chimeraX, a short text is loaded revealing information about the residue/atom/bond my mouse is hovering on. I want to take advantage of this feature, but I want to perform a task different from the default one but still specific to the part of the structure my mouse is hovering on. As of now, I don't really know how to go about this and I am trying to locate the scripts that encode the original feature just so I can get an idea of how to go about this. Could you please help locate those scripts (if possible)? Regards, Shubham
_______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Manage subscription: