PYTHON用一堆坐标在屏幕画点的代码
时间: 2023-03-06 15:28:30 浏览: 73
可以这样写:import pygame pygame.init() screen = pygame.display.set_mode((400, 300)) while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pygame.draw.circle(screen, (255, 0, 0), (150, 150), 10)
pygame.display.update()
相关问题
python每输入一个坐标画一个点代码
您可以使用Python的turtle模块来画图形,以下是根据输入的坐标画点的示例代码:
```python
import turtle
# 获取输入的坐标
x = int(input("请输入横坐标:"))
y = int(input("请输入纵坐标:"))
# 初始化 turtle
t = turtle.Turtle()
# 将画笔移动到指定的坐标
t.penup()
t.goto(x, y)
# 画点
t.dot(5)
# 隐藏画笔
t.hideturtle()
# 显示画布
turtle.done()
```
该代码将在画布上画出一个指定坐标的点。您可以多次运行该代码来画出多个点。
用python写一个循环点击屏幕坐标的代码
以下是一个使用 Python 的 PyAutoGUI 模块来实现循环点击屏幕坐标的代码:
```python
import pyautogui
import time
# 定义要点击的坐标
x, y = 100, 100
# 循环点击屏幕坐标
while True:
pyautogui.click(x, y)
# 间隔一定时间再次点击
time.sleep(1)
```
以上代码会在定义的坐标位置上循环点击,每次点击间隔 1 秒钟。你可以根据实际需要修改坐标和时间间隔。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)