#NEWLINE# def trim( self , top , count = None ) : #NEWLINE# #INDENT# 'Trim lines from the top and/or bottom of canvas.\n\n        top -- number of lines to remove from top\n        count -- number of lines to keep, or None for all the rest\n        ' #NEWLINE# assert ( top >= 0 ) , ( 'invalid trim amount %d!' % top ) #NEWLINE# assert ( top < self . rows ( ) ) , ( 'cannot trim %d lines from %d!' % ( top , self . rows ( ) ) ) #NEWLINE# if self . widget_info : #NEWLINE# #INDENT# raise self . _finalized_error #NEWLINE# #UNINDENT# if top : #NEWLINE# #INDENT# self . shards = shards_trim_top ( self . shards , top ) #NEWLINE# #UNINDENT# if ( count == 0 ) : #NEWLINE# #INDENT# self . shards = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( count is not None ) : #NEWLINE# #INDENT# self . shards = shards_trim_rows ( self . shards , count ) #NEWLINE# #UNINDENT# #UNINDENT# self . coords = self . translate_coords ( 0 , ( - top ) )