Пример #1
0
def parse_image_gif(*args, **kw):
    """Create the appropriate image handler, and replace this function with
    the handler for future references (to skip the determination step)."""

    global parse_image_gif
    if _use_pil and AsyncImage.isPILAllowed():
        parse_image_gif = PILGifParser
    else:
        parse_image_gif = TkGifParser
    return apply(parse_image_gif, args, kw)
Пример #2
0
def init_types():
    """Load the image type information dictionary based on what form of image
    support we're using."""
    global allowed_types
    allowed_types = {}
    if AsyncImage.isPILAllowed():
        from PIL import Image
        for datatype in Image.MIME.values():
            type, subtype = string.splitfields(datatype, '/')
            if type == "image":
                allowed_types[datatype] = datatype
    else:
        # standard Tk is relatively limited:
        for datatype in ("image/gif", "image/x-portable-graymap",
                         "image/x-portable-pixmap"):
            allowed_types[datatype] = datatype
Пример #3
0
def init_types():
    """Load the image type information dictionary based on what form of image
    support we're using."""
    global allowed_types
    allowed_types = {}
    if AsyncImage.isPILAllowed():
        import Image
        for datatype in Image.MIME.values():
            type, subtype = string.splitfields(datatype, '/')
            if type == "image":
                allowed_types[datatype] = datatype
    else:
        # standard Tk is relatively limited:
        for datatype in ("image/gif",
                         "image/x-portable-graymap",
                         "image/x-portable-pixmap"):
            allowed_types[datatype] = datatype