[Chimera-users] Capture click event
pett at cgl.ucsf.edu
Mon Aug 30 14:04:15 PDT 2021
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.
UCSF Computer Graphics Lab
> On Aug 30, 2021, at 11:48 AM, jeni_zen2004--- via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
> 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.
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chimera-users