That button will disappear automatically while either of the following is true:
- All learnable hero abilities for the hero are at max level and the hero doesn't have any extra skill points
- The hero has no learnable abilities at all (generally the same case as above, unless the unit has no abilities in the editor)
You can abuse this to temporarily hide the the learn skill button by doing the following:
- Store the current level of all learned abilities of the hero.
- Store information about which abilities haven't been learned yet at all.
- Store the current number of unspent skill points.
- For every ability in step 1, set its level to the max possible level
- For every ability found in step 2 do the following
- Increase the hero's number of unspent skill points by 1
- Force the hero to learn the skill (Hero - Learn skill action)
- Set its level to max level
- Disable the ability for the hero (Unit - for <unit>, <ability>, Disable ability: true, Hide UI: true)
- Set the current number of unspent skill points for the hero to 0
- Wait until you want to show the button again; during this time all abilities will be at maximum level, which may be important for auras and tooltips
- For every ability found in step 2 (same as 5) do the following:
- Remove the ability from the hero (it will still be learnable after this)
- Enable the ability for the hero
- For every ability modified in step 4, set it back to its original level
- Set the hero's number of unspent skill points to the number stored in step 3
Not the greatest but it does work.