I am calling a fucntion for a pygame so i need to have it in a loop and i want to add 50 to a variable called sy=100. The function reads a directory looking for any python files and if it finds them i want to display the first file at 100 which is the start point of sy. then i want to add 50 to the variable and then it write the next file at the next point without moving the first one so far it just writes the text all at the same point and moves it down the screen so how would i get it so each file is seperated by 50 pixels and the text doesn't move.
Heres my Function
def games():
f = 0
sy = 100
file = []
ftext = pygame.font.SysFont("Arial", 20)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
screen.fill(DarkSpace)
ToolBarButton("Home", 0, 0, 150, 50, SpaceGrey, CornflowerBlue, 10, cmain)
ToolBarButton(username, 153,0,150,50, SpaceGrey, CornflowerBlue, 10, accountDetails)
ToolBarButton("Programs", 305,0,150,50, SpaceGrey, CornflowerBlue, 10, programs)
ToolBarButton("Games", 458,0,150,50, SpaceGrey, CornflowerBlue, 10, games)
ToolBarButton("Help", 610,0,150,50, SpaceGrey, CornflowerBlue, 10, hel)
DropDown(NeonGreen, CornflowerBlue, 764, 16, 30, 30, DropMenu)
Btext(screen, "Loading Games!", CornflowerBlue, ftext, 600,600,600,600)
fileDir = os.listdir("Games\\")
for fileN in fileDir:
verif = fileN.endswith('.py') or fileN.endswith('.pyw')
if not verif:
fileDir.remove(fileN)
else:
text(screen, fileN, CornflowerBlue, ftext, 400,sy)
pygame.display.update()