asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

tripleClick causes crash on MacOS #698

Closed Jarno-de-Wit closed 2 weeks ago

Jarno-de-Wit commented 2 years ago

The tripleClick function, when called on MacOS, will cause the program to crash with a TypeError: not enough arguments for format string. This issue arises in line 1168 when formatting the string "%s,3,%s%s" % (x, y). This string expects 3 values to format (namely (button, x, y)), but the "button" variable is missing from the formatting section.

To fix, update the line to: _logScreenshot(logScreenshot, "click", "%s,3,%s,%s" % (button, x, y), folder=".")

JayRizzo commented 2 years ago

Verified.

import pyautogui

pyautogui.tripleClick(150, 150)
pyautogui.tripleClick(logScreenshot=True, x=150, y=150)

Both worked as expected with this change on my MBP.

Thanks @Jarno-de-Wit !