title: How to pause a while loop until a certain key is pressed?
body: <p>I want the clicking to pause when you press <code>xbutton1</code> and it to continue when I press <code>xbutton2</code>.</p>
  <p>Here's my code:</p>
  <pre><code>import win32api
  import win32con
  import pyautogui
  
  click = True
  
  
  def clicking():
      get = win32api.GetKeyState(win32con.VK_LBUTTON)
      if get &lt; 1:
          pyautogui.click()
  
  
  def stop():
      if win32api.GetKeyState(win32con.VK_XBUTTON1):
          click = False
  
  
  def continue_program():
      if win32api.GetKeyState(win32con.VK_XBUTTON2):
          click = True
  
  
  while True:
      if click == True:
          clicking()
  
      else:
          stop()
  </code></pre>