title: Python Inputs module - detect axis of gamepad joystick with lenience?
body: <p>To simplify this problem, let's say I simply want to be able to detect whether my gamepad's right thumbstick is being pushed up (but not horizontally, within some lenience), pushed to the right (but not up, within some lenience) or being pushed to the left (but not up, within some lenience).</p>
  
  <p>Unfortunately, the lenience is required, but I haven't found a way to do it yet. Thusfar I have been using the inputs library:
  <a href="https://pypi.org/project/inputs/" rel="nofollow noreferrer">https://pypi.org/project/inputs/</a>
  But it's not super well documented and as far as I can tell it doesn't let you compare an exact angle of the thumbstick at any one time.</p>
  
  <p>Using their own example code, I have this snippet of a function:</p>
  
  <pre><code>def get_true_game_input():
      inputArray = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
      # All the different buttons that are important to be detected, including whether the thumbstick has been moved left, right, or up
      events = get_gamepad()
      for event in events:
        if event.code == "ABS_RY":
          if event.state &gt;= 8000:
              print("top Guard!")
              inputArray[5] = 1
        elif event.code == "ABS_RX":
          if event.state &gt;= 8000:
              inputArray[6] = 1
              print("right guard!")
        elif event.state &lt;= -8000:
              inputArray[4] = 1
              print("left guard!")
  </code></pre>
  
  <p>Which works up until one moves the stick, for example, upwards, then ever so slightly to the left or right, whereupon it will detect that instead.</p>
  
  <p>The problem is that, with the way Inputs seems to work, <code>events</code> is always either empty, or of size 1. So it will either detect a horizontal movement or a vertical movement, and one will overwrite the other. </p>
  
  <p>Is there some way to solve this? I am also open to rebuilding this using a different library, but cannot find any other. I am using a dualshock 4 controller using the DS4 Tool.</p>
  
  <p>Any help or advice would be greatly appreciated. Thank you.</p>