Taking control of the string displayed in a pbond associated tooltip

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

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/

Saverio, Though it isn't exactly what you want, you could print information about the pseudobond to the log with some python code. Tom has previously written an example for hovering when you hover over atoms here: https://rbvi.github.io/chimerax-recipes/hover/hover.html. For pseudobonds, you'd replace "PickedAtom" with "PickedPseudobond", get the pseudobond object with "pick.pbond" instead of "pick.atom", and then work with whatever attributes the psedobond object has. Hope that helps, Tony On Tue, May 27, 2025 at 12:27 PM 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/

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/

Hi Saverio, You could add a regular (always-displayed) label, but maybe that would be too ugly if you have lots of pseudobonds and you want to label them all. Example commands: open 1bzv show pbond /B:4@OE1:10@NE2 label /B:4@OE1:10@NE2 pseudobonds text "blah blah blah" <https://rbvi.ucsf.edu/chimerax/docs/user/commands/label.html> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Resource for Biocomputing, Visualization, and Informatics Department of Pharmaceutical Chemistry University of California, San Francisco
On May 27, 2025, at 5:18 PM, Eric Pettersen via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
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/
_______________________________________________ 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/
participants (5)
-
Elaine Meng
-
Eric Pettersen
-
svle@tiscali.it
-
Tom Goddard
-
Tony Schaefer