【发布时间】:2015-12-20 11:41:17
【问题描述】:
你好,我有这个代码
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()
他给了我这个错误
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "C:\Users\filippo\Desktop\Win32.py", line 5, in Cursor
win32api.SetCursorPos(10,10)
TypeError: SetCursorPos() takes exactly 1 argument (2 given)
为什么?他告诉我我必须输入 1 个参数,但 x 和 y 轴应该是 2
【问题讨论】:
-
您的错误在第 4 行,
win32api.SetCurPos采用一个元组而不是两个整数。
标签: python windows python-3.x pywin32