def setSongs(self): songList = [] self.myfont = pygame.font.SysFont(None, 30) self.mainText = self.myfont.render('Songs in ' + self.playlist, 1, [255, 255, 255]) self.songs = self.client.listplaylistinfo(self.playlist) y = self.mainText.get_height() exitLoop = False i = self.currentSong showNum = 0 while not exitLoop and i < self.getMax(): current = Text_Control().changeText( ('SONG' + str(showNum)), self.songs[i]['title'] + '-' + self.songs[i]['artist'], 0, y, -1, self.surface, self.myfont) if (current.get_rect().height + y < self.surface.get_height()): songList.append(current) self.touchList[('SONG' + str(showNum))] = pygame.Rect( 0, y, songList[showNum].get_rect().width, songList[showNum].get_rect().height) y = y + songList[showNum].get_height() i = i + 1 showNum = showNum + 1 else: self.maxInView = i - self.currentSong exitLoop = True
def showScreen(self): DynamicBackground().fillDynamicBackgroundColor(self.surface) self.myfont = pygame.font.SysFont(None, 30) self.songs = self.client.listplaylistinfo(self.playlist) self.mainText = self.myfont.render('Songs in '+self.playlist, 1, [255,255,255]) self.surface.blit(self.mainText,(self.surface.get_width()/2-self.mainText.get_rect().width/2, 0)) for i in range(0,self.maxInView): tc = Text_Control() tc.printKey('SONG'+str(i)) return self.surface
def showScreen(self, surface): self.surface = surface DynamicBackground().fillDynamicBackgroundColor(self.surface) self.myfont = pygame.font.SysFont(None, 30) self.songs = self.client.listplaylistinfo(self.playlist) self.mainText = self.myfont.render('Songs in ' + self.playlist, 1, [255, 255, 255]) self.surface.blit(self.mainText, (self.surface.get_width() / 2 - self.mainText.get_rect().width / 2, 0)) for i in range(0, self.maxInView): tc = Text_Control() tc.printKey('SONG' + str(i)) return self.surface
def setSongs(self): songList = [] self.myfont = pygame.font.SysFont(None, 30) self.mainText = self.myfont.render('Songs in '+self.playlist, 1, [255,255,255]) self.songs = self.client.listplaylistinfo(self.playlist) y = self.mainText.get_height() exitLoop = False i = self.currentSong showNum = 0 while not exitLoop and i < self.getMax(): current = Text_Control().changeText(('SONG'+str(showNum)), self.songs[i]['title']+'-'+self.songs[i]['artist'], 0, y,-1,self.surface,self.myfont) if (current.get_rect().height+y < self.surface.get_height()): songList.append(current) self.touchList[('SONG'+str(showNum))] = pygame.Rect(0,y,songList[showNum].get_rect().width,songList[showNum].get_rect().height) y = y + songList[showNum].get_height() i = i +1 showNum = showNum +1 else: self.maxInView = i - self.currentSong exitLoop = True