[Chimera-users] Capture click event
Eric Pettersen
pett at cgl.ucsf.edu
Mon Aug 30 14:04:15 PDT 2021
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 at 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 at cgl.ucsf.edu
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20210830/a4328cf9/attachment.html>
More information about the Chimera-users
mailing list