shenzhen-solitaire.py
def save_card_imgs():
    """Save current image squares to CARD_DIR."""
    img = grab_screenshot()

    # Piles
    for xl in range(8):
        for yl in range(5):
            card_img = img.crop((X0 + xl * XD, Y0 + yl * YD,
                                 X1 + xl * XD, Y1 + yl * YD))
            card_img.save(os.path.join(CARD_DIR, "%s%s.png" % (xl, yl)))

    # Rose
    rr_card = img.crop((XROSE0, YTOP0, XROSE1, YTOP1))
    rr_card.save(os.path.join(CARD_DIR, "rose_space.png"))

    # Spaces
    for xl in range(3):
        card_img = img.crop((XSPACE0 + xl * XTOPD, YTOP0,
                             XSPACE1 + xl * XTOPD, YTOP1))
        card_img.save(os.path.join(CARD_DIR, "space%s.png" % xl))
Save current image squares to CARD_DIR.
Save current image squares to CARD_DIR.
Save current image squares to CARD_DIR .
def save_card_imgs():
    img = grab_screenshot()
    for xl in range(8):
        for yl in range(5):
            card_img = img.crop((X0 + xl * XD, Y0 + yl * YD,
                                 X1 + xl * XD, Y1 + yl * YD))
            card_img.save(os.path.join(CARD_DIR, "%s%s.png" % (xl, yl)))
    rr_card = img.crop((XROSE0, YTOP0, XROSE1, YTOP1))
    rr_card.save(os.path.join(CARD_DIR, "rose_space.png"))
    for xl in range(3):
        card_img = img.crop((XSPACE0 + xl * XTOPD, YTOP0,
                             XSPACE1 + xl * XTOPD, YTOP1))
        card_img.save(os.path.join(CARD_DIR, "space%s.png" % xl))
def save_card_imgs ( ) : img = grab_screenshot ( ) for xl in range ( 8 ) : for yl in range ( 5 ) : card_img = img . crop ( ( X0 + xl * XD , Y0 + yl * YD , X1 + xl * XD , Y1 + yl * YD ) ) card_img . save ( os . path . join ( CARD_DIR , "%s%s.png" % ( xl , yl ) ) ) rr_card = img . crop ( ( XROSE0 , YTOP0 , XROSE1 , YTOP1 ) ) rr_card . save ( os . path . join ( CARD_DIR , "rose_space.png" ) ) for xl in range ( 3 ) : card_img = img . crop ( ( XSPACE0 + xl * XTOPD , YTOP0 , XSPACE1 + xl * XTOPD , YTOP1 ) ) card_img . save ( os . path . join ( CARD_DIR , "space%s.png" % xl ) )
Save current image squares to CARD_DIR.
Save current image squares to CARD_DIR .
"""Save current image squares to CARD_DIR.""" # Piles # Rose # Spaces