()
Create an icon file for the present platform.
Create an icon file for the present platform.
Create an icon file for the present platform .
def build_icon():
    """Create an icon file for the present platform."""
    try:
        os.mkdir('resources')
    except EnvironmentError:
        pass
    # build icon
    flat = (_b for _row in ICON for _b in _row)
    rgb = ((_b*255,)*3 for _b in flat)
    rgbflat = (_b for _tuple in rgb for _b in _tuple)
    imgstr = b''.join(int2byte(_b) for _b in rgbflat)
    width, height = len(ICON[0]), len(ICON)
    img = Image.frombytes('RGB', (width, height), imgstr)
    format = {'win32': 'ico', 'darwin': 'icns'}.get(sys.platform, 'png')
    img.resize((width*2, height*2)).save('resources/pcbasic.%s' % (format,))
def build_icon ( ) : try : os . mkdir ( 'resources' ) except EnvironmentError : pass # build icon flat = ( _b for _row in ICON for _b in _row ) rgb = ( ( _b * 255 , ) * 3 for _b in flat ) rgbflat = ( _b for _tuple in rgb for _b in _tuple ) imgstr = b'' . join ( int2byte ( _b ) for _b in rgbflat ) width , height = len ( ICON [ 0 ] ) , len ( ICON ) img = Image . frombytes ( 'RGB' , ( width , height ) , imgstr ) format = { 'win32' : 'ico' , 'darwin' : 'icns' } . get ( sys . platform , 'png' ) img . resize ( ( width * 2 , height * 2 ) ) . save ( 'resources/pcbasic.%s' % ( format , ) )