title: Python win32api event shift not releasing key when other text is added
body: <p><strong>Major Edit</strong> Narrowed down the replication considerably</p>
  
  <p>I am having issues with using shift in Python using the win32api keybd_event in Windows 10.</p>
  
  <p>I want to be able to key down on shift, and then key up on shift.</p>
  
  <p>The following file works as expect exactly as is. It pressed shift, then releases shift. (<code>160</code> is key code for left shift)</p>
  
  <pre><code>import time
  import win32con
  import win32api
  from win32api import keybd_event, mouse_event
  
  time.sleep(3)
  keybd_event(160, 0, 1, 0)
  time.sleep(1)
  keybd_event(160, 0, 2, 0)
  time.sleep(1)
  </code></pre>
  
  <p>When I add the following to the end however, shift stays on key down for the rest of the program as well as after program execution until the active window is changed. (<code>84</code> is key code for t)</p>
  
  <pre><code>keybd_event(84, 0, 1, 0)
  time.sleep(1)
  keybd_event(84, 0, 2, 0)
  time.sleep(1)
  </code></pre>
  
  <p>This is as bare bones as I can replicate the issue with all abstraction removed. This is critically breaking what I'm trying to do and I can't make progress.</p>
  
  <p><strong>Why is key up on shift not working when there is other keyboard actions happening?</strong></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Passing in bScan key codes gives same behavior that code is below</p>
  
  <pre><code>time.sleep(3)
  keybd_event(160, 0x10, 1, 0)
  time.sleep(1)
  keybd_event(160, 0x10, 2, 0)
  time.sleep(1)
  
  keybd_event(84, 0x54, 1, 0)
  time.sleep(1)
  keybd_event(84, 0x54, 2, 0)
  time.sleep(1)
  </code></pre>