'In pygame, after timeout, a function that starts again from the beginning

import pygame as pg
pg.init()

def fixTime():
    totalTime = 4
    return totalTime

while 1:
    flowTime = int(pg.time.get_ticks()/1000)
    elapsed_time = (fixTime() - flowTime)

    if elapsed_time <=0:
        fixTime()
    else:
        print(elapsed_time)

When the current ends, 1 is repeated, but I want to make a function that returns the time to the beginning.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source