title: pyautogui mouseDown() not working for automated mouse movement
body: <p>In chapter 20 of Automate the Boring Things, there is an example that uses pyautogui to draw a spiral. The code uses <code>.drag()</code> to draw each segment, but on each corner the mouse releases the cursor and starts a new line. This creates a break in each corner for whatever brush type you are using.</p>
  <p><a href="https://i.stack.imgur.com/3MLS0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3MLS0.png" alt="enter image description here" /></a></p>
  <p>To address this aesthetic issue I tried to modify the code to use <code>.mouseDown()</code> and <code>.move()</code> instead. However this ended up drawing nothing except a line going from the top left corner to the bottom left corner, as if each iteration of the while loop was repeating a click.</p>
  <p>By testing:</p>
  <pre><code>while True:
      pyautogui.mouseDown()
  </code></pre>
  <p>In mspaint, the .mousedown() function is indeed performing correctly when I move the mouse myself.</p>
  <p>Trying:</p>
  <pre><code>while True:
      pyautogui.mouseDown()
      pyautogui.move(300, 0, duration=0.5)
  </code></pre>
  <p>Also correctly draws a line, but does so in 300 pixel chunks. I.e. every time the loop iterated the line segment would load in on mspaint.</p>
  <p>Repeating this experiment in a square:</p>
  <pre><code>while True:
      pyautogui.mouseDown()
      pyautogui.move(300, 0, duration=0.5)
      pyautogui.move(0, 300, duration=0.5)
      pyautogui.move(-300, 0, duration=0.5)
      pyautogui.move(0, -300, duration=0.5)
  </code></pre>
  <p>Ended up drawing nothing.</p>
  <p>What is going on here? Why is the <code>.mouseDown()</code> behavior so inconsistent? How do I get my code to draw a nice unbroken spiral?</p>
  <p>Full original code for reference here:</p>
  <pre><code>#! python3
  # spiralDraw.py - draws a spiral in mspaint
  
  import pyautogui
  import time
  
  time.sleep(5)   # give time to go to paint app
  distance = 300
  change = 20
  pyautogui.mouseDown()
  
  while distance &gt; 0:
      pyautogui.move(distance, 0, duration=0.5)   
      distance = distance - change
      pyautogui.move(0, distance, duration=0.5)   
      pyautogui.move(-distance, 0, duration=0.5)  
      distance = distance - change
      pyautogui.move(0, -distance, duration=0.5)
      
  if distance == 0:
      pyautogui.mouseUp()
  </code></pre>