Question: I'm using python 2.7 in windows and I need to be able to code a right click at a certain xy coordinate. I already have the left click capability using this:

```
def click(x,y):
    win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)

```

Any similar/completely different way to code a right click xy dependant function?

Answer: 
Use `win32con.MOUSEEVENTF_RIGHTDOWN` and `win32con.MOUSEEVENTF_RIGHTUP` as the first argument for the respective calls to `mouse_event`. If this change alone does not help it can be beneficial when inserting a short pause between the mouse down and up with `time.sleep(0.05)`
from this link:
[mouse\_even function on MSDN](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646260%28v=vs.85%29.aspx)

looks like you can replace

`MOUSEEVENTF_LEFTDOWN` -> `MOUSEEVENTF_RIGHTDOWN`

`MOUSEEVENTF_LEFTUP` -> `MOUSEEVENTF_RIGHTUP`