I've never used kgPanels, and looking through the code, it looks like it takes in Lua code to run a script. I can provide code to feed into the addon, but I wouldn't know where to go to put it in. This is made to run in version 1.5.4.4 if it makes any difference. There's an added check because kgPanels appears to register CLICK events as 2 handler functions. Without checking a local variable it injects into the user script, it'll run the code twice in one click.
Code:
if released then SetActiveTalentGroup(GetActiveTalentGroup()%2+1); end
Note:
released appears to be a local defined inside kgPanels to determine that it's running from the OnMouseUp handler.