Win32Api Python .SetCursorPos(x,y)如何工作?

时间:2015-12-20 11:41:18

标签: python windows python-3.x pywin32

你好我有这个代码

#!/bin/bash

PHOTOS_DIR=$1
PHOTOS_LIST=$2

while read line           
do
    echo "line: ${line}"
    pattern="*`echo \"$line\" | tr ' ' '*'`*"
    echo "pattern: ${pattern}"
done < <(tr -d '\n' < $PHOTOS_LIST)

他给我这个错误

import win32api
from tkinter import *

def Cursor():
    win32api.SetCursorPos(10,10)

root = Tk()
root.geometry("500x500")
root.title("")
root.configure(background="#262626")

PlayButton = Button(root, text="Cursor", command=Cursor ).pack()


root.mainloop()

为什么呢?他告诉我,我必须输入1个参数但x和y轴应该是2

1 个答案:

答案 0 :(得分:3)

将坐标作为元组传递:

def Cursor():
    win32api.SetCursorPos((10,10))