code: def _update_textrotation(self, angle):
          
  
          states = {0: 0, -90: 1, 180: 2, 90: 3}
  
          try:
              self.rotation_tb.state = states[round(angle)]
          except KeyError:
              self.rotation_tb.state = 0
  
          self.rotation_tb.toggle(None)
          self.rotation_tb.Refresh()
docs: Updates text rotation toggle button