Mouseclick

Terje Johan Abrahamsen terjej at mailandnews.com
Mon May 2 14:30:31 EDT 2005


Hello.

I have been trying desperately for a while to make Python push the
left mousebutton. I have been able to let Python push a button in a
box:

def click(hwnd):
    win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, 0)
    win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, 0, 0)

optDialog = findTopWindow(wantedText="Options")

def findAButtonCalledOK(hwnd, windowText, windowClass):
    return windowClass == "Button" and windowText == "OK"
okButton = findControl(optDialog, findAButtonCalledOK)

click(okButton)

As described here, http://tinyurl.com/cwjls. But, that is not what I
am looking for. I would like to specify some coordinates such as
windll.user32.SetCursorPos(450, 370) and thereafter click the left
mousebutton at that place.

I know that the sollution lies somewhere with Microsoft
(http://www.6URL.com/FED), but cannot understand how to make Python
click the button regardless of how much I try.

Thanks in advance.



More information about the Python-list mailing list