Disable all buttons

Hello,

I m using a function that disables all my buttons one by one which works great but i was wondering if it s possible to do something like
function buttonsOff{check who is a button;disable it}
function buttonsOn{check who is a button;enable it}

My buttons are all on root.

TiA :wink: