
Hi Saverio, As Tom mentions, the form of a pseudobond tooltip will always be "string-repr-of-pb pb-length", but since string-repr-of-pb is obtained with str(pb) which in turn calls Pseudobond.__str__, which in turn calls Pseudobond.string, you can override the string-repr-of-pb part of the tooltip by monkey patching in your own version of Pseudobond.string. I recommend this approach only for personal or local use because the instant two different bundles try to do this, they will stomp on each other and only one will work. Also not good form to monkey patch core code. Anyway, the following code snippet would allow you to change the string repr for a specific type of pseudobond ("custom" in the code example, which is the type " pbond" uses unless you provide the "name" argument), and will return the standard string for other types: from chimerax.atomic import Pseudobond, Bond def custom_name(self, *args, **kw): if self.group.name == "custom": return "custom text" return Bond.string(self, *args, **kw) Pseudobond.string = custom_name --Eric Eric Pettersen UCSF Computer Graphics Lab
On May 27, 2025, at 11:24 AM, Tom Goddard via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Saverio,
There is no capability to specify the tooltip text for a pseudobond (or regular bond, or atom). It always specifies the two atoms and the distance between them. It might be interesting to add the capability to specify custom text. But it require adding that to the PseudoBond C++ data structures and session saving code so that the text is remembered and that is a good bit of work.
Here is the code in ChimeraX that sets pseudobond tooltip text.
https://github.com/RBVI/ChimeraX/blob/3176f3cf0ad4d0a2d49dcd2efea2872160ce4a...
Tom
On May 24, 2025, at 4:27 AM, saverio via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi, I have specified some pseudobonds using pbond. It is possible to add a string, conveying other related informations , to that displayed in the tooltip when hovering the mouse on the pseudobond? Also, it is possible to take the complete control of what is displayed in the tooltip?
Thanks.
Saverio
_______________________________________________ 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/
_______________________________________________ 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/