How to change buttons with different Icons at the same place

Hi!
i don´t know exactly how to define my if condition to replace my Buttons
with different icons at the same place.
Can You help?

only two Buttons:


   def draw(self, context):
        toolsettings = context.tool_settings  
        layout = self.layout

        button = use

        if button == False:
            layout.operator("operator_1", text="Left", icon="TRIA_LEFT").use

        else:
            layout.operator("operator_2", text="Right", icon="TRIA_RIGHT").use 

more than two Buttons:


   def draw(self, context):
        toolsettings = context.tool_settings  
        layout = self.layout

        button = use

        if button == False:
            layout.operator("operator_1", text="Up", icon="TRIA_UP").use
        
        eflif:
            layout.operator("operator_2", text="Down", icon="TRIA_DOWN").use

        eflif:
            layout.operator("operator_3", text="Left", icon="TRIA_LEFT").use

        else:
            layout.operator("operator_4", text="Right", icon="TRIA_RIGHT").use 

hi… first is elif

second… all elif need some aditional information…like if…

for example…


if a== 0:
     print("hello")
elif a> 0 :
     print("see you tomorrow")
else:
     print("bye")

I hope this help

bye

Sometimes, an abbreviated syntax is useful:

layout.operator(“operator_1”, text=“Left”, icon=“TRIA_LEFT” if button else “TRIA_RIGHT”)