您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Python中每17毫秒在屏幕上绘制一个点?

在Python中每17毫秒在屏幕上绘制一个点?

您应该尝试使用pygame进行图形处理。首先下载pygame

这是示例代码

import pygame,sys
from pygame import *

WIDTH = 480
HEIGHT = 480
WHITE = (255,255,255) #RGB
BLACK = (0,0,0) #RGB

pygame.init()
screen = display.set_mode((WIDTH,HEIGHT),0,32)
display.set_caption("Name of Application")
screen.fill(WHITE)
timer = pygame.time.Clock()
pos_on_screen, radius = (50, 50), 20    
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    timer.tick(60) #60 times per second you can do the math for 17 ms
    draw.circle(screen, BLACK, pos_on_screen, radius)
    display.update()

希望有帮助。请记住,您需要先下载pygame。您还应该阅读pygame。这真的很有帮助。

python 2022/1/1 18:47:31 有449人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶