我一直在试图弄清楚如何解决这个错误。这是我第一次遇到这样的错误。我在谷歌上搜索过,我找不到解决这个问题的方法。
Traceback (most recent call last):
File "C:\Users\Parent\Desktop\NEW PROJECT\code testing and practice.py", line 49, in <module>
print startGame()
File "C:\Users\Parent\Desktop\NEW PROJECT\code testing and practice.py", line 30, in startGame
mousePos(304, 197)
TypeError: mousePos() takes exactly 1 argument (2 given)
def leftClick():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
print "Click."
def leftDown():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
print 'left Down'
def leftUp():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(.1)
print 'left release'
这是我得到我的错误:
def mousePos(cord):
win32api.SetCursorPos(x_pad + cord[0], y_pad + cord[1])
def get_cords():
x,y = win32api.GetCursorPos()
x = x - x_pad
y = y - y_pad
print x,y
def startGame():
#location of first menu
mousePos(304, 197)
leftClick()
time.sleep(.1)
#location of second menu
mousePos(338, 394)
leftClick()
time.sleep(.1)
#location of third menu
mousePos(576, 453)
leftClick()
time.sleep(.1)
#location of fourth menu
mousePos(311, 397)
leftClick()
time.sleep(.1)
print startGame()