How toggle between showing and hiding buttons depending on what you select

Hi, we are trying to create a button on the panel. However, I would like to show or hide the button depending on the selected object. How should I do?

In the current state, the script will generate an error if you select anything other than an object, since you just put a button.
For example, the Add Modifier button now gives an error when selecting an armature.
It may be better to use the if syntax, but I do not know very well now.
I want to do it. > Simple button in the script panel.
Switch the display of the button by the selection of the object and armature.
What is switching display> I want to switch the button display and hide with.
I do not want to give an error.

We found the answer by us.