ah, figured the shelf thing. Just type the 'toggleTrans() bit into the script editor, highlight it all and middle mouse drag onto your custom shelf. A window will popup asking if it is mel or python (choose python) and then you have the control all ready to use
Si