(data, wildcard_records, width, img_height, offset)
return image
Draw an image of a list of standing record of each team.
        This is the Wild card version which is a bit more elaborate. need to figure a way to merge both draw_standings
        and draw_wild_card together.
        :return image
Draw an image of a list of standing record of each team.
        This is the Wild card version which is a bit more elaborate. need to figure a way to merge both draw_standings
        and draw_wild_card together.
        :return image
Draw an image of a list of standing record of each team . This is the Wild card version which is a bit more elaborate . need to figure a way to merge both draw_standings and draw_wild_card together . : return image
def draw_wild_card(data, wildcard_records, width, img_height, offset):
    """
        Draw an image of a list of standing record of each team.
        This is the Wild card version which is a bit more elaborate. need to figure a way to merge both draw_standings
        and draw_wild_card together.
        :return image
    """
    teams_info = data.teams_info
    layout = data.config.layout
    # Create a new data image.
    image = Image.new('RGB', (width, img_height))
    draw = ImageDraw.Draw(image)

    """
        Each record info is shown in a row of 7 pixel high. The initial row start at pixel 0 (top screen). For each
        team's record we add an other row and increment the row position by the height of a row plus the
        incrementation "i".
    """
    row_pos = 0
    row_height = 7
    top = row_height - 1  # For some reason, when drawing with PIL, the first row is not 0 but -1

    draw.text((1, 0), wildcard_records["conference"], font=layout.font)
    row_pos += row_height
    for division, division_data in wildcard_records["division_leaders"].items():
        draw.text((1, row_pos), division, font=layout.font)
        row_pos += row_height
        for record in division_data["teamRecords"]:
            team_id = record["team"]['id']
            abbev = teams_info[team_id].abbreviation
            points = str(record['points'])
            wins = record['leagueRecord']['wins']
            losses = record['leagueRecord']['losses']
            ot = record['leagueRecord']['ot']
            team_colors = data.config.team_colors
            bg_color = team_colors.color("{}.primary".format(team_id))
            txt_color = team_colors.color("{}.text".format(team_id))
            draw.rectangle([0, top + row_pos, 12, row_pos], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
            draw.text((1, row_pos), abbev, fill=(txt_color['r'], txt_color['g'], txt_color['b']), font=layout.font)
            if len(points) == 3:
                draw.text((54, row_pos), points, font=layout.font)
            else:
                draw.text((57, row_pos), points, font=layout.font)
            draw.text((19, row_pos), "{}-{}-{}".format(wins, losses, ot), font=layout.font)
            row_pos += row_height
        # add a space of one row of 2 LED between each tables
        row_pos += offset

    draw.text((1, row_pos), "wild card", font=layout.font)
    row_pos += row_height
    for record in wildcard_records["wild_card"]:
        team_id = record["team"]['id']
        abbev = teams_info[team_id].abbreviation
        points = str(record['points'])
        wins = record['leagueRecord']['wins']
        losses = record['leagueRecord']['losses']
        ot = record['leagueRecord']['ot']
        team_colors = data.config.team_colors
        bg_color = team_colors.color("{}.primary".format(team_id))
        txt_color = team_colors.color("{}.text".format(team_id))
        draw.rectangle([0, top + row_pos, 12, row_pos], fill=(bg_color['r'], bg_color['g'], bg_color['b']))
        draw.text((1, row_pos), abbev, fill=(txt_color['r'], txt_color['g'], txt_color['b']), font=layout.font)
        if len(points) == 3:
            draw.text((54, row_pos), points, font=layout.font)
        else:
            draw.text((57, row_pos), points, font=layout.font)
        draw.text((19, row_pos), "{}-{}-{}".format(wins, losses, ot), font=layout.font)
        row_pos += row_height

    return image
def draw_wild_card ( data , wildcard_records , width , img_height , offset ) : teams_info = data . teams_info layout = data . config . layout # Create a new data image. image = Image . new ( 'RGB' , ( width , img_height ) ) draw = ImageDraw . Draw ( image ) """
        Each record info is shown in a row of 7 pixel high. The initial row start at pixel 0 (top screen). For each
        team's record we add an other row and increment the row position by the height of a row plus the
        incrementation "i".
    """ row_pos = 0 row_height = 7 top = row_height - 1 # For some reason, when drawing with PIL, the first row is not 0 but -1 draw . text ( ( 1 , 0 ) , wildcard_records [ "conference" ] , font = layout . font ) row_pos += row_height for division , division_data in wildcard_records [ "division_leaders" ] . items ( ) : draw . text ( ( 1 , row_pos ) , division , font = layout . font ) row_pos += row_height for record in division_data [ "teamRecords" ] : team_id = record [ "team" ] [ 'id' ] abbev = teams_info [ team_id ] . abbreviation points = str ( record [ 'points' ] ) wins = record [ 'leagueRecord' ] [ 'wins' ] losses = record [ 'leagueRecord' ] [ 'losses' ] ot = record [ 'leagueRecord' ] [ 'ot' ] team_colors = data . config . team_colors bg_color = team_colors . color ( "{}.primary" . format ( team_id ) ) txt_color = team_colors . color ( "{}.text" . format ( team_id ) ) draw . rectangle ( [ 0 , top + row_pos , 12 , row_pos ] , fill = ( bg_color [ 'r' ] , bg_color [ 'g' ] , bg_color [ 'b' ] ) ) draw . text ( ( 1 , row_pos ) , abbev , fill = ( txt_color [ 'r' ] , txt_color [ 'g' ] , txt_color [ 'b' ] ) , font = layout . font ) if len ( points ) == 3 : draw . text ( ( 54 , row_pos ) , points , font = layout . font ) else : draw . text ( ( 57 , row_pos ) , points , font = layout . font ) draw . text ( ( 19 , row_pos ) , "{}-{}-{}" . format ( wins , losses , ot ) , font = layout . font ) row_pos += row_height # add a space of one row of 2 LED between each tables row_pos += offset draw . text ( ( 1 , row_pos ) , "wild card" , font = layout . font ) row_pos += row_height for record in wildcard_records [ "wild_card" ] : team_id = record [ "team" ] [ 'id' ] abbev = teams_info [ team_id ] . abbreviation points = str ( record [ 'points' ] ) wins = record [ 'leagueRecord' ] [ 'wins' ] losses = record [ 'leagueRecord' ] [ 'losses' ] ot = record [ 'leagueRecord' ] [ 'ot' ] team_colors = data . config . team_colors bg_color = team_colors . color ( "{}.primary" . format ( team_id ) ) txt_color = team_colors . color ( "{}.text" . format ( team_id ) ) draw . rectangle ( [ 0 , top + row_pos , 12 , row_pos ] , fill = ( bg_color [ 'r' ] , bg_color [ 'g' ] , bg_color [ 'b' ] ) ) draw . text ( ( 1 , row_pos ) , abbev , fill = ( txt_color [ 'r' ] , txt_color [ 'g' ] , txt_color [ 'b' ] ) , font = layout . font ) if len ( points ) == 3 : draw . text ( ( 54 , row_pos ) , points , font = layout . font ) else : draw . text ( ( 57 , row_pos ) , points , font = layout . font ) draw . text ( ( 19 , row_pos ) , "{}-{}-{}" . format ( wins , losses , ot ) , font = layout . font ) row_pos += row_height return image