Итак, я нашел видео на Youtube, в котором показано, как создать полосу загрузки в PyGame, но проблема в том, что он выдает ошибку NameE, в которой говорится, что «render» не существует
Я пытался посмотреть,этот «рендер» существовал в более новых версиях, но не нашел решения
smallfont = pygame.font.SysFont("comicsansms",25)
DS = pygame.display.set_mode((W, H))
def text_objects(text, color, size):
if size == "small":
textSurface = smallfont.render(text, True, color)
return textSurface, textSurface.get_rect()
def loading(progress):
if progress < 100:
text = smallfont/render("Loading: " + str(int(progress)) + "%", True, green)
else:
text = smallfont.render("Loading: " + str(100) + "%", True, green)
DS.blit(text, [453, 273])
def message_to_screen(msh, color, y_displace = 0, size = "small"):
textSurf, textRect = text_objects(msg, color, size)
textRect.center = HW, HH + y_displace
DS.blit(textSurf, textRect)
while (progress/2) < 100:
time_count = (random.randint(1,1))
increase = random.randint(1,20)
progress += increase
pygame.draw.rect(DS, green, [423, 223, 204, 49])
pygame.draw.rect(DS, BLACK, [424, 224, 202, 47])
if (progress/2) > 100:
pygame.draw.rect(DS, green, [425, 225, 200, 45])
else:
pygame.draw.rect(DS, green, [425, 225, progress, 45])
loading(progress/2)
pygame.display.flip()
time.sleep(time_count)
Ожидаемым результатом должна быть строка загрузки, просто отображающая и загружающая, однако я просто получаю NameError для «render»«