Capture click event

Hi, Is there a way to capture the Chimera click event or a way to work around?I'm trying to do something from python code like., when a user clicks on a residue, it pops up a tooltip or shows the centroid. Thanks,Catherine

Hi Catherine, You can use chimera.mousemodes.addFunction(name, callables) to define a possible mouse button function and chimera.mousemodes.setButtonFunction(button, modifiers, function) to assign the defined function to a particular mouse button. For addFunction(), "name" is just some descriptive text (e.g. "show centroid") and "callables" are a list of either 3 or 5 Python functions (that each take two args: viewer, event) for when the mouse button is pressed, the mouse is moved (with the button down), or the mouse is released, and for the 5-function version, also double-click pressed, double-click released. Any of those functions can be None if you don't have any need to respond to them. For setButtonFunction(), button is "1" (left), "2" (middle), or "3" (right) [strings, not integers]. "modifiers" is a tuple of "Ctrl", "Shift", or nothing. "function" is the same as the "name" arg for addFunction(). If you want an example of their use, the gui.py file in the Ilabel module uses these functions. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Aug 30, 2021, at 11:48 AM, jeni_zen2004--- via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Hi,
Is there a way to capture the Chimera click event or a way to work around? I'm trying to do something from python code like., when a user clicks on a residue, it pops up a tooltip or shows the centroid.
Thanks, Catherine
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (2)
-
Eric Pettersen
-
jeni_zen2004@yahoo.co.in