#load all images from the Frames folder def LoadImages(): files = os.listdir("Frames") for each in files: if (each.lower().endswith( (".png", ".bmp") )): load = os.path.join("Frames", each) Global.Frame.append (each) Global.NumberOfFrames += 1 if Global.NumberOfFrames == 3: Global.NumberOfFrames = 0