Lua Code:
ShowUIPanel(PlayerTalentFrame) -- Always opens on the last used tab
HideUIPanel(PlayerTalentFrame)
PlayerTalentFrame_Toggle(GetActiveSpecGroup()) -- 1 for primary 2 for secondary
PlayerTalentFrame_ToggleGlyphFrame(GetActiveSpecGroup()) -- 1 for primary 2 for secondary