这是一个带有tkinter的应用程序,可以在坐标指示的位置移动鼠标,所以我使用了正常变量,但由于某些原因,它不起作用,鼠标只是不移动,没有错误。我试着去掉变量,使用正常的数字,结果很好,为什么变量会出错呢?错误是什么
coord1= Entry(win, width=10)
coord1.place(x=300, y=125)
coord2= Entry(win, width=10)
coord2.place(x=400, y=125)
b = coord2.get()
c = coord1.get()
d = int(c,0)
e = int(b,0)
pyautogui.click(d, e)
由于您在创建两个
Entry
小部件之后立即获得它们的值,因此您应该获得空字符串,因为用户没有输入任何内容。因此int(c, 0)
将异常失败您应该执行移入操作,例如,回调按钮,以便用户可以在执行移入操作之前将值输入到两个
Entry
小部件中此外,如果要移动鼠标光标,则应使用
pyautogui.moveTo(...)
而不是pyautogui.click(...)
下面是一个简单的例子:
相关问题 更多 >
编程相关推荐