title: How to trigger mouse clicks only when a key is pressed ? In Python
body: <p>I want to make a program or when I click on a key the mouse clicks automatically (as long as I click on the key) if I do not click on the key it stops.</p>
  <p>I don't want the clicks to happen only when I touch the key once, but as long as the key is held down (It can also be the left button of the mouse pressed that trigger clicks like razer synapse mouses)</p>
  <p>Any Idea ?</p>
  <p><strong>EDIT 1 :</strong></p>
  <p>This one works but not when a key is held down (even when the click is held down it doesn't work anyway) it only detects a single click on the mouse and then it clicks by itself instead of clicking <strong>ONLY</strong> when the key is held down...</p>
  <pre><code>import pyautogui, time
  from pynput import mouse
  from pynput.mouse import Button,Controller
  from tkinter import *
  from tkinter import ttk
  
  
  root = Tk()
  root.geometry('500x400') 
  
  combo = ttk.Combobox(root,values=['ctrl','shift','alt'],width=5)
  combo.set('Key...')
  combo.pack()
  
  
  
  def on_click(x, y, button, pressed):
      if button == mouse.Button.left:
          while pressed:
              pyautogui.click()
              pyautogui.PAUSE = 0.1
          else:
              return False
  
  with mouse.Listener(
      on_click=on_click
      ) as Listener:
           Listener.join()
  
  root.mainloop()
  </code></pre>