code: def on_click(self, event):
          
          if event["button"] == self.button_toggle:
              if "DPMS is Enabled" in self.py3.command_output("xset -q"):
                  self.py3.command_run("xset -dpms s off")
              else:
                  self.py3.command_run("xset +dpms s on")
  
          if event["button"] == self.button_off:
              self.py3.command_run("xset dpms force off")
docs: Control DPMS with mouse clicks.