title: Is there a way to send / press NUMPAD keys in python?
body: <p>So far I have tried pyautogui to send them, but it doesn't work. I was hoping because in the source code it shows this:</p>
  
  <pre><code>'num multiply': '*',
  'num divide': '/',
  'num add': '+',
  'num plus': '+',
  'num minus': '-',
  'num sub': '-',
  'num enter': 'enter',
  'num 0': '0',
  'num 1': '1',
  'num 2': '2',
  'num 3': '3',
  'num 4': '4',
  'num 5': '5',
  'num 6': '6',
  'num 7': '7',
  'num 8': '8',
  'num 9': '9',
  </code></pre>
  
  <p>but that didn't do anything other than what you might expect. It would do regular numbers, and not the numpad specific ones.</p>
  
  <pre><code>pyautogui.press("num 3")
  </code></pre>
  
  <p>for example, doesn't work at all, and</p>
  
  <pre><code>pyautogui.press("3")
  </code></pre>
  
  <p>just sends a 3</p>
  
  <p>I have also tried win32api's SendKeys, but that doesn't have the numkeys listed at all, and going through the source code over there, it looks like they're included (<a href="https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes</a>) but aren't supported in the Python implementation...so this doesn't work:</p>
  
  <pre><code>&gt;&gt;&gt; import win32api
  &gt;&gt;&gt; import win32com.client
  &gt;&gt;&gt; shell = win32com.client.Dispatch("WScript.Shell")
  &gt;&gt;&gt; shell.SendKeys("{NUMPAD7}")
  </code></pre>
  
  <p>that returns </p>
  
  <pre><code>pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024809), None)
  </code></pre>
  
  <p>I need to be able to use the numpad keys because I have a setup that uses an emulated mouse that I need to programatically control via those keys. I have figured out a workaround by disabling and re-enabling the emulation (I'm using NeatMouse) via a key-combination that works (and can be sent with SendKeys) because you rarely type and use the mouse at the same time, but I am still very curious about whether what I want to do is actually possible directly.</p>
  
  <p>To reiterate, I want to directly press NUMPAD keys via python.</p>
  
  <p>Thanks!</p>