Grouped buttons, highlight pressed button, un-highlight the rest

I'm building a touch-bar that contains a set of buttons. I'd like that when one button is pressed it's highlighted and any other highlit buttons are un-highlighted. Rather like radio buttons, only one button can ever be active or highlighted.

At the moment I'm storing a hash table of UUIDs in a Python class and calling a method in each button's script that highlights that button and clears the rest but I find this a bit kludgy; it's annoying to set up and it's not a very general solution.

what I could really do with is:

  • a way to access the current button's UUID from its script
  • a way to access other button or widget UUIDs, maybe from a user-set tag or something
  • possibly a way to get a list of sibling widgets.

I general, I guess, a way for a button action to access and modify other buttons or widgets in the bar would be very useful

Or maybe someone has other suggestions on how to do this in a tidier way.

Thoughts appreciated