#NEWLINE# def key_down( self , key , code ) : #NEWLINE# #INDENT# index = self . selected_index #NEWLINE# if ( index is None ) : #NEWLINE# #INDENT# index = 0 #NEWLINE# #UNINDENT# if ( key == pygame . K_DOWN ) : #NEWLINE# #INDENT# self . select ( min ( ( len ( self . items ) - 1 ) , ( index + 1 ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key == pygame . K_UP ) : #NEWLINE# #INDENT# self . select ( max ( 0 , ( index - 1 ) ) )