企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ """ 字体 """ import time import pygame from pygame.locals import * import sys # 框架的初始化 pygame.init() # 创建了一个窗体 window = pygame.display.set_mode((700, 600)) # 通过死循环去阻塞窗体关闭 while True: # 清空窗体 (r,g,b) 0-255 # window.fill((0, 0, 0)) start = time.time() # 清空窗体 window.fill((0, 0, 0)) # 刷新界面 pygame.display.flip() events = pygame.event.get() for event in events: if event.type == QUIT: # 窗体关闭 pygame.quit() sys.exit(0) end = time.time() diff = end - start # 防止0 try: fps = 1 / diff # 打印帧率 print(fps) except Exception as error: pass ~~~