Python PIL.Image 模块,show() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用PIL.Image.show()

项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack()
项目:WXBotForPi    作者:nemoTyrant    | 项目源码 | 文件源码
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack()

# End of file
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack()

# End of file
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack()

# End of file
项目:alfred-image-utilities    作者:danielecook    | 项目源码 | 文件源码
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack()
项目:imagepaste    作者:robinchenyu    | 项目源码 | 文件源码
def getimage(photo):
    """Copies the contents of a PhotoImage to a PIL image memory."""
    photo.tk.call("PyImagingPhotoGet", photo)


# --------------------------------------------------------------------
# Helper for the Image.show method.
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def getimage(photo):
    """Copies the contents of a PhotoImage to a PIL image memory."""
    photo.tk.call("PyImagingPhotoGet", photo)


# --------------------------------------------------------------------
# Helper for the Image.show method.
项目:magenta    作者:byxor    | 项目源码 | 文件源码
def show(self):
        """Displays the image (mainly for debugging). Check the PIL Image.show()
        documentation to find out more."""
        self.__image.show()
项目:iReminder    作者:r-kan    | 项目源码 | 文件源码
def get_image(file_handle):
        # Note:
        #   1. need convert to 'RGB' for some (transparent) format image cannot be shown using PhotoImage
        #      don't know why, but those image actually can be shown by Image itself (usg Image.show)
        #   2. use file_handle instead of filename, for in Windows, Image.open() seems not close its
        #      handle upon IOError, and thus, induces an unexpected file lock
        return Image.open(file_handle).convert("RGB")