擅长:python、mysql、java
<p><code>pyautogui</code>返回一个<code>Point</code>,它是形式为<code>(x,y)</code>的二维坐标</p>
<p>您需要使用<a href="https://www.khanacademy.org/math/basic-geo/basic-geometry-pythagorean-theorem/pythagorean-theorem-distance/a/distance-formula" rel="nofollow noreferrer">Distance Formula</a>来计算任意两点之间的距离</p>
<p>工作示例如下</p>
<pre><code>import time
import pyautogui
import math
time.sleep(1)
x = (pyautogui.position())
time.sleep(1)
y = (pyautogui.position())
dist = math.sqrt((y.x - x.x)**2 + (y.y - x.y)**2)
print(round(dist, 2))
</code></pre>
<p>而且,<code>pyautogui</code>不是python3中<code>tkinter</code>模块的一部分。所以我已经分别安装和导入了它。你知道吗</p>