【发布时间】:2021-01-06 00:53:37
【问题描述】:
它没有显示任何错误,只是在显示底部显示空白而不是 printng 开始
import pygame
import time
pygame.init()
black = (0,0,0)
white = (255,255,255)
Display = pygame.display.set_mode((800,600))
pygame.display.set_caption('fitness')
font = pygame.font.SysFont(None,200)
def message_to_screen(msg,color):
screen_text = font.render(msg,True,color)
Display.blit(screen_text, [800/2, 600/2])
exercises =["pelvic shift","hanging","single leg hopping","puppy pose","side strech","low lunge arcs", "cobra strech","jogging,skipping","vertical bends","standing strechs","side bends","swimming","toe lifts","land swimming" ,"legs up alternate", "leg kicks" , "wake up stretchinggutes and hip bridges","forward spine stretch","cat camel back stetch","mermaid stretch","cycling","jump squats","cobra stretch","downward facing dog" , "bird dog", "inversion table exercise", "surya namaskars" , "side planks"]
def exerciseLoop():
for x in exercises:
for number_of_exercise in range(1,29):
z = exercises.index(x)
if number_of_exercise == (z+1):
final={}
final.update({number_of_exercise:x})
message_to_screen("start",black)
clock = pygame.time.Clock()
FPS = 30
clock.tick(FPS)
Display.fill(white)
pygame.display.update()
exerciseLoop()
【问题讨论】:
-
可能
number_of_exercise不等于z + 1? -
你已经问了两次同一个问题:stuck in an infinite loop,python,pygame。你不应该那样做。改进原来的问题,而不是两次问同一个问题。
标签: python function loops for-loop pygame