def scrollaround(data, stend, data2=None): #using the coordinates of the scroll bar update the menu to show the according data tempmn = Menu(1, len(data), 300, 600, [0, 0], (0, 200), [lightgrey, darkgrey] * (len(data) // 2) + [lightgrey] * (len(data) % 2), ['text'] + data[stend[0]:stend[1]], 950, 60, 40) if data2 != None: tempmn.secondtext = data2[stend[0]:stend[1]] tempmn.secpad = 700 return tempmn
playerranked[x].rank = x + 1 playername = [ 'Ranked:' + str(x + 1) + ' Player: ' + str(playerranked[x].number) + ' ' + playerranked[x].name for x in range(len(playerranked)) ] rankedmn = Menu(1, len(playerranked), 300, 600, [0, 0], (0, 200), [lightgrey, darkgrey] * (len(playerranked) // 2) + [lightgrey] * (len(playerranked) % 2), ['text'] + playername[0:11], 950, 60, 40) pointslist = [ rankedmn.font.render(str(x), True, white) for x in pointslist ] rankedmn.secondtext = pointslist[0:11] rankedmn.secpad = 700 rankedscroll.newBar(playername) rankedscroll.bar.pos = (rankedscroll.x, rankedscroll.y) mode = 6 elif playerbtn.handle_event(event): mode = 4 teamfile = open(teamname, 'w') elif savebtn.handle_event(event): teamfile = open(teamname, 'w') savebool = True for p in playerclass: p.save(teamfile) teamfile.close() elif mode == 6: #scroll event during ranked