#NEWLINE# def get_icon( iconpath , size = None , format = 'png' ) : #NEWLINE# #INDENT# image = io_rgb . PILimage . open ( iconpath ) #NEWLINE# if ( image is not None ) : #NEWLINE# #INDENT# ( wd , ht ) = size #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( wd , ht ) = ( 24 , 24 ) #NEWLINE# #UNINDENT# image = image . resize ( ( wd , ht ) ) #NEWLINE# img_buf = BytesIO ( ) #NEWLINE# image . save ( img_buf , format = format ) #NEWLINE# icon = get_image_src_from_buffer ( img_buf . getvalue ( ) , imgtype = format ) #NEWLINE# return icon