title: How do I simulate mouse clicks with Xlib on Python
body: <p>For educational purposes I've set out to write a python script using <code>cwiid</code> and <code>Xlib</code> so that I can use my wiimote like a mouse.</p>
  
  <p>So far I've gotten the cursor to move by calling <code>disp.warp_pointer(dx,dy)</code> then calling <code>disp.sync()</code> every set time interval. I'm afraid that it might not be the most efficient way to do it but at least for now, it's simple and works well enough.</p>
  
  <p>The problem I'm having more difficulty with is mouse clicks. How do I simulate a mouse click in Xlib? I would like separate press and release events so that I can drag and drop stuff. I've come across <a href="https://stackoverflow.com/questions/3545230/simulate-mouse-clicks-on-python">this</a> post, but all of the solutions there seem to use other libraries.</p>