Toggle switches (and rheostats) come with a threaded shank with a notch. The notch is supposed to engage a tab in the hole so the switch won't turn. That works fine when you have the correct sheet metal punch to make the odd-shaped hole, and doesn't work at all when you just drill a round hold.
Allied makes "locking rings"; washers with a tab on the inside to grab the shank, and a bent-down tab on the outside to go into a small hole drilled in the panel. Sort of like the lock washers some wheel bearing nuts have.
https://www.alliedelec.com/carling-tech ... /70131727/