Beispiel #1
0
Datei: GUI.py Projekt: S-bite/tk
    def __init__(self, game):
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
        img = pyglet.image.load("graphics/back.png", decoder=PNGImageDecoder())
        img = img.get_region(0, 0, self.GUI_width,
                             self.GUI_height - self.GUI_map_height)
        self.BACK_IMAGE = img  #=img.get_region(0,0,self.GUI_width,self.GUI_height-self.GUI_map_height)
        self.CHAR_IMAGES = []
        img = pyglet.image.load("graphics/chars.png",
                                decoder=PNGImageDecoder())
        #img.get_image_data()
        for char in pyglet.image.ImageGrid(img, img.height // 32,
                                           img.width // 32):
            self.CHAR_IMAGES.append(char)

        self.TERRAIN_IMAGES = []
        img = pyglet.image.load("graphics/chip12e_map_fall.png",
                                decoder=PNGImageDecoder())
        #img.get_image_data()
        for terrain in pyglet.image.ImageGrid(img, img.height // 32,
                                              img.width // 32):
            self.TERRAIN_IMAGES.append(terrain)
        raw = pyglet.image.load('graphics/b_light.png',
                                decoder=PNGImageDecoder())

        raw_seq = pyglet.image.ImageGrid(raw, 5, 5)
        anim = pyglet.image.Animation.from_image_sequence(raw_seq, 0.1, 1)
        self.test_anim = pyglet.sprite.Sprite(anim)
        self.was_game_changed = True
        self.game = game
        self.keys = key.KeyStateHandler()
        self.window.push_handlers(self.keys)
Beispiel #2
0
    def gentiles(self):

        self.unknown = pyglet.image.load(
            join(TILESDIR,
                 'unknown.png'), decoder=PNGImageDecoder()).get_texture()

        self.tiledict = defaultdict(lambda: self.unknown)
        for root, subfolders, files in walk(TILESDIR):
            for image_file in files:
                image = pyglet.image.load(
                    join(root,
                         image_file), decoder=PNGImageDecoder()).get_texture()
                tilename = image_file[:-4]
                self.tiledict[tilename] = image.get_texture()
Beispiel #3
0
def image(name):
    if name not in image_memo:
        image_memo[name] = pyglet.image.load("images/%s.png" % name,
                                             decoder=PNGImageDecoder())

        image_memo[name].blit(-1.0, 1.0, 0.0,
                              2.0, 2.0)
Beispiel #4
0
    def __init__(self):

        self.batch = pyglet.graphics.Batch()

        # Загрузить изображение
        fname = 'pics/txtr.png'
        img = pyglet.image.load(fname, decoder=PNGImageDecoder())
        self.TexGroup = pyglet.graphics.TextureGroup(img.get_texture())
Beispiel #5
0
 def __init__(self, filename):
     self.bitmap = pyglet.image.load(filename, decoder=PNGImageDecoder())
     self.x = 0
     self.y = 0
     self.width = self.bitmap.width
     self.height = self.bitmap.height
     self.ox = 0
     self.oy = 0
     self.angle = 0
     self.visible = True
Beispiel #6
0
    def __init__(self):

        # не освещать внутренние поверхности объектов
        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE)

        self.batch = pyglet.graphics.Batch()

        # Загрузить изображение
        fname = 'pics/txtr.png'
        img =  pyglet.image.load(fname, decoder=PNGImageDecoder())
        self.TexGroup = pyglet.graphics.TextureGroup(img.get_texture())
Beispiel #7
0
def _run_pyglet(fname, fmt):
    from pyglet import window, image, gl
    from pyglet.window import key

    if fmt == "png":
        from pyglet.image.codecs.png import PNGImageDecoder
        img = image.load(fname, decoder=PNGImageDecoder())
    else:
        raise ValueError("pyglet preview works only for 'png' files.")

    offset = 25

    config = gl.Config(double_buffer=False)
    win = window.Window(
        width=img.width + 2*offset,
        height=img.height + 2*offset,
        caption="sympy",
        resizable=False,
        config=config
    )

    win.set_vsync(False)

    try:
        def on_close():
            win.has_exit = True

        win.on_close = on_close

        def on_key_press(symbol, modifiers):
            if symbol in [key.Q, key.ESCAPE]:
                on_close()

        win.on_key_press = on_key_press

        def on_expose():
            gl.glClearColor(1.0, 1.0, 1.0, 1.0)
            gl.glClear(gl.GL_COLOR_BUFFER_BIT)

            img.blit(
                (win.width - img.width) / 2,
                (win.height - img.height) / 2
            )

        win.on_expose = on_expose

        while not win.has_exit:
            win.dispatch_events()
            win.flip()
    except KeyboardInterrupt:
        pass

    win.close()
Beispiel #8
0
 def _load_event_sprite(self):
     """
     When rendering, the top left corner displays the current event through a sprite
     """
     #
     if self.current_event == self.E_STILL:
         image = pyglet.image.load('Sprites/still.png', decoder=PNGImageDecoder())
         event_sprite = pyglet.sprite.Sprite(img=image)
         self.current_event_sprite.replaceSprite(event_sprite)
     elif self.current_event == self.E_RANDOM:
         image = pyglet.image.load('Sprites/random.png', decoder=PNGImageDecoder())
         event_sprite = pyglet.sprite.Sprite(img=image)
         self.current_event_sprite.replaceSprite(event_sprite)
     elif self.current_event == self.E_REACH:
         image = pyglet.image.load('Sprites/grasp.png', decoder=PNGImageDecoder())
         event_sprite = pyglet.sprite.Sprite(img=image)
         self.current_event_sprite.replaceSprite(event_sprite)
     else:
         image = pyglet.image.load('Sprites/push.png', decoder=PNGImageDecoder())
         event_sprite = pyglet.sprite.Sprite(img=image)
         self.current_event_sprite.replaceSprite(event_sprite)
Beispiel #9
0
    def createDrawableObjects(self):
        """
        Create sprite objects that will be drawn within the
        window.
        """
        ball_img = pyglet.image.load('images/ball.png',
                                     decoder=PNGImageDecoder())
        ball_img.anchor_x = ball_img.width / 2
        ball_img.anchor_y = ball_img.height / 2

        self.ballSprite = pyglet.sprite.Sprite(ball_img)
        self.ballSprite.position = (self.ballSprite.width + 100,
                                    self.ballSprite.height * 2 - 50)

        self.drawableObjects.append(self.ballSprite)
Beispiel #10
0
def load_list(abstract_path):
    '''
    get the list of files with short name
    :return: a list of idex by short file name to full_path + filename
    '''
    temp_list = {}
    result_list = {}
    fullpath = join(Path(__file__).resolve().parents[1], Path(abstract_path))
    if isdir(fullpath):
        temp_list = [f for f in listdir(fullpath) if isfile(join(fullpath, f))]
    for f in temp_list:
        i = splitext(basename(f))[0]
        resource = Resource()
        resource.full_path = join(fullpath, f)
        resource.stream = open(resource.full_path, 'rb')
        if resource.full_path.endswith('.png'):
            resource.data = pyglet.image.load(i,
                                              file=resource.stream,
                                              decoder=PNGImageDecoder())
        elif resource.full_path.endswith('.ogg'):
            resource.data = pyglet.media.load(resource.full_path)
        result_list[i] = resource
        print('%s %s' % (i, join(fullpath, f)))
    return result_list
Beispiel #11
0
def preview(expr,
            output='png',
            viewer=None,
            euler=True,
            packages=(),
            **latex_settings):
    r"""
    View expression or LaTeX markup in PNG, DVI, PostScript or PDF form.

    If the expr argument is an expression, it will be exported to LaTeX and
    then compiled using available the TeX distribution.  The first argument,
    'expr', may also be a LaTeX string.  The function will then run the
    appropriate viewer for the given output format or use the user defined
    one. By default png output is generated.

    By default pretty Euler fonts are used for typesetting (they were used to
    typeset the well known "Concrete Mathematics" book). For that to work, you
    need the 'eulervm.sty' LaTeX style (in Debian/Ubuntu, install the
    texlive-fonts-extra package). If you prefer default AMS fonts or your
    system lacks 'eulervm' LaTeX package then unset the 'euler' keyword
    argument.

    To use viewer auto-detection, lets say for 'png' output, issue

    >>> from sympy import symbols, preview, Symbol
    >>> x, y = symbols("x,y")

    >>> preview(x + y, output='png') # doctest: +SKIP

    This will choose 'pyglet' by default. To select a different one, do

    >>> preview(x + y, output='png', viewer='gimp') # doctest: +SKIP

    The 'png' format is considered special. For all other formats the rules
    are slightly different. As an example we will take 'dvi' output format. If
    you would run

    >>> preview(x + y, output='dvi') # doctest: +SKIP

    then 'view' will look for available 'dvi' viewers on your system
    (predefined in the function, so it will try evince, first, then kdvi and
    xdvi). If nothing is found you will need to set the viewer explicitly.

    >>> preview(x + y, output='dvi', viewer='superior-dvi-viewer') # doctest: +SKIP

    This will skip auto-detection and will run user specified
    'superior-dvi-viewer'. If 'view' fails to find it on your system it will
    gracefully raise an exception. You may also enter 'file' for the viewer
    argument. Doing so will cause this function to return a file object in
    read-only mode.

    Currently this depends on pexpect, which is not available for windows.

    Additional keyword args will be passed to the latex call, e.g., the
    symbol_names flag.

    >>> phidd = Symbol('phidd')
    >>> preview(phidd, symbol_names={phidd:r'\ddot{\varphi}'}) # doctest: +SKIP

    """

    # we don't want to depend on anything not in the
    # standard library with SymPy by default
    import pexpect

    special = ['pyglet']

    if viewer is None:
        if output == "png":
            viewer = "pyglet"
        else:
            # sorted in order from most pretty to most ugly
            # very discussable, but indeed 'gv' looks awful :)
            candidates = {
                "dvi": ["evince", "okular", "kdvi", "xdvi"],
                "ps": ["evince", "okular", "gsview", "gv"],
                "pdf": ["evince", "okular", "kpdf", "acroread", "xpdf", "gv"],
            }

            try:
                for candidate in candidates[output]:
                    if pexpect.which(candidate):
                        viewer = candidate
                        break
                else:
                    raise SystemError(
                        "No viewers found for '%s' output format." % output)
            except KeyError:
                raise SystemError("Invalid output format: %s" % output)
    else:
        if viewer not in special and not pexpect.which(viewer):
            raise SystemError("Unrecognized viewer: %s" % viewer)

    actual_packages = packages + ("amsmath", "amsfonts")
    if euler:
        actual_packages += ("euler", )
    package_includes = "\n".join(
        ["\\usepackage{%s}" % p for p in actual_packages])

    format = r"""\documentclass[12pt]{article}
                 %s
                 \begin{document}
                 \pagestyle{empty}
                 %s
                 \vfill
                 \end{document}
              """ % (package_includes, "%s")

    if isinstance(expr, str):
        latex_string = expr
    else:
        latex_string = latex(expr, mode='inline', **latex_settings)

    tmp = tempfile.mktemp()

    with open(tmp + ".tex", "w") as tex:
        tex.write(format % latex_string)

    cwd = os.getcwd()
    os.chdir(tempfile.gettempdir())

    if os.system("latex -halt-on-error %s.tex" % tmp) != 0:
        raise SystemError("Failed to generate DVI output.")

    os.remove(tmp + ".tex")
    os.remove(tmp + ".aux")
    os.remove(tmp + ".log")

    if output != "dvi":
        command = {
            "ps": "dvips -o %s.ps %s.dvi",
            "pdf": "dvipdf %s.dvi %s.pdf",
            "png": "dvipng -T tight -z 9 " + "--truecolor -o %s.png %s.dvi",
        }

        try:
            if os.system(command[output] % (tmp, tmp)) != 0:
                raise SystemError("Failed to generate '%s' output." % output)
            else:
                os.remove(tmp + ".dvi")
        except KeyError:
            raise SystemError("Invalid output format: %s" % output)

    src = "%s.%s" % (tmp, output)
    src_file = None

    if viewer == "file":
        src_file = open(src, 'rb')
    elif viewer == "pyglet":
        try:
            from pyglet import window, image, gl
            from pyglet.window import key
        except ImportError:
            raise ImportError(
                "pyglet is required for plotting.\n visit http://www.pyglet.org/"
            )

        if output == "png":
            from pyglet.image.codecs.png import PNGImageDecoder
            img = image.load(src, decoder=PNGImageDecoder())
        else:
            raise SystemError("pyglet preview works only for 'png' files.")

        offset = 25

        win = window.Window(width=img.width + 2 * offset,
                            height=img.height + 2 * offset,
                            caption="sympy",
                            resizable=False)

        win.set_vsync(False)

        try:

            def on_close():
                win.has_exit = True

            win.on_close = on_close

            def on_key_press(symbol, modifiers):
                if symbol in [key.Q, key.ESCAPE]:
                    on_close()

            win.on_key_press = on_key_press

            def on_expose():
                gl.glClearColor(1.0, 1.0, 1.0, 1.0)
                gl.glClear(gl.GL_COLOR_BUFFER_BIT)

                img.blit((win.width - img.width) / 2,
                         (win.height - img.height) / 2)

            win.on_expose = on_expose

            while not win.has_exit:
                win.dispatch_events()
                win.flip()
        except KeyboardInterrupt:
            pass

        win.close()
    else:
        os.system("%s %s &> /dev/null &" % (viewer, src))
        time.sleep(2)  # wait for the viewer to read data

    os.remove(src)
    os.chdir(cwd)

    if src_file is not None:
        return src_file
Beispiel #12
0
 def load_image(filename):
     """Loads an image from the specified filename"""
     with pyglet.resource.file(filename) as f:
         # Other decoders cause the application to crash on Linux
         decoder = PNGImageDecoder()
         return pyglet.image.load(filename, file=f, decoder=decoder)
Beispiel #13
0
def preview(expr, output='png', viewer=None, euler=True):
    """View expression in PNG, DVI, PostScript or PDF form.

       This will generate LaTeX representation of the given expression
       and compile it using available TeX distribution. Then it will
       run appropriate viewer for the given output format or use the
       user defined one. If you prefer not to use external viewer
       then you can use combination of 'png' output and 'pyglet'
       viewer. By default png output is generated.

       By default pretty Euler fonts are used for typesetting (they
       were used to typeset the well known "Concrete Mathematics"
       book). For that to work, you need the 'eulervm.sty' LaTeX style (in
       Debian/Ubuntu, install the texlive-fonts-extra package). If you prefer
       default AMS fonts or your system lacks 'eulervm' LaTeX package then
       unset the 'euler' keyword argument.

       To use viewer auto-detection, lets say for 'png' output, issue::

           >> from sympy import *
           >> x, y = symbols("xy")

           >> preview(x + y, output='png')

       This will choose 'pyglet by default. To select different one::

           >> preview(x + y, output='png', viewer='gimp')

       The 'png' format is considered special. For all other formats
       the rules are slightly different. As an example we will take
       'dvi' output format. If you would run::

           >> preview(x + y, output='dvi')

       then 'view' will look for available 'dvi' viewers on your
       system (predefined in the function, so it will try evince,
       first, then kdvi and xdvi). If nothing is found you will
       need to set the viewer explicitly::

           >> preview(x + y, output='dvi', viewer='superior-dvi-viewer')

       This will skip auto-detection and will run user specified
       'superior-dvi-viewer'. If 'view' fails to find it on
       your system it will gracefully raise an exception.

       Currently this depends on pexpect, which is not available for windows.
    """

    # we don't want to depend on anything not in the
    # standard library with SymPy by default
    import pexpect

    special = [ 'pyglet' ]

    if viewer is None:
        if output == "png":
            viewer = "pyglet"
        else:
            # sorted in order from most pretty to most ugly
            # very discussable, but indeed 'gv' looks awful :)
            candidates = {
                "dvi" : [ "evince", "okular", "kdvi", "xdvi" ],
                "ps"  : [ "evince", "okular", "gsview", "gv" ],
                "pdf" : [ "evince", "okular", "kpdf", "acroread", "xpdf", "gv" ],
            }

            try:
                for candidate in candidates[output]:
                    if pexpect.which(candidate):
                        viewer = candidate
                        break
                else:
                    raise SystemError("No viewers found for '%s' output format." % output)
            except KeyError:
                raise SystemError("Invalid output format: %s" % output)
    else:
        if viewer not in special and not pexpect.which(viewer):
            raise SystemError("Unrecognized viewer: %s" % viewer)

    if not euler:
        format = r"""\documentclass[12pt]{article}
                     \usepackage{amsmath}
                     \begin{document}
                     \pagestyle{empty}
                     %s
                     \vfill
                     \end{document}
                 """
    else:
        format = r"""\documentclass[12pt]{article}
                     \usepackage{amsmath}
                     \usepackage{eulervm}
                     \begin{document}
                     \pagestyle{empty}
                     %s
                     \vfill
                     \end{document}
                 """

    if viewer == "pyglet":
        # import pyglet before we change the current dir, because after that it
        # would fail:
        from sympy.thirdparty import import_thirdparty
        pyglet = import_thirdparty("pyglet")
    tmp = tempfile.mktemp()

    tex = open(tmp + ".tex", "w")
    tex.write(format % latex(expr, mode='inline'))
    tex.close()

    cwd = os.getcwd()
    os.chdir(tempfile.gettempdir())

    if os.system("latex -halt-on-error %s.tex" % tmp) != 0:
        raise SystemError("Failed to generate DVI output.")

    os.remove(tmp + ".tex")
    os.remove(tmp + ".aux")
    os.remove(tmp + ".log")

    if output != "dvi":
        command = {
            "ps"  : "dvips -o %s.ps %s.dvi",
            "pdf" : "dvipdf %s.dvi %s.pdf",
            "png" : "dvipng -T tight -z 9 " + \
                    "--truecolor -o %s.png %s.dvi",
        }

        try:
            if os.system(command[output] % (tmp, tmp)) != 0:
                raise SystemError("Failed to generate '%s' output." % output)
            else:
                os.remove(tmp + ".dvi")
        except KeyError:
            raise SystemError("Invalid output format: %s" % output)

    src = "%s.%s" % (tmp, output)

    if viewer == "pyglet":
        from pyglet import window, image, gl
        from pyglet.window import key

        if output == "png":
            from pyglet.image.codecs.png import PNGImageDecoder
            img = image.load(src, decoder=PNGImageDecoder())
        else:
            raise SystemError("pyglet preview works only for 'png' files.")

        offset = 25

        win = window.Window(
            width = img.width + 2*offset,
            height = img.height + 2*offset,
            caption = "sympy",
            resizable = False
        )

        win.set_vsync(False)

        try:
            def on_close():
                win.has_exit = True

            win.on_close = on_close

            def on_key_press(symbol, modifiers):
                if symbol in [key.Q, key.ESCAPE]:
                    on_close()

            win.on_key_press = on_key_press

            def on_expose():
                gl.glClearColor(1.0, 1.0, 1.0, 1.0)
                gl.glClear(gl.GL_COLOR_BUFFER_BIT)

                img.blit(
                    (win.width - img.width) / 2,
                    (win.height - img.height) / 2
                )

            win.on_expose = on_expose

            while not win.has_exit:
                win.dispatch_events()
                win.flip()
        except KeyboardInterrupt:
            pass

        win.close()
    else:
        os.system("%s %s &> /dev/null &" % (viewer, src))
        time.sleep(2) # wait for the viewer to read data

    os.remove(src)
    os.chdir(cwd)
def get_weather():
    global weather_img, main_temp, temp_desc, sunrise, sunset
    global day_1_icon, day_2_icon, day_3_icon, day_4_icon, day_5_icon, day_6_icon, day_7_icon
    global day_1_desc, day_2_desc, day_3_desc, day_4_desc, day_5_desc, day_6_desc, day_7_desc
    global day_1_max, day_2_max, day_3_max, day_4_max, day_5_max, day_6_max, day_7_max
    global day_1_min, day_2_min, day_3_min, day_4_min, day_5_min, day_6_min, day_7_min
    global day_1_humid, day_2_humid, day_3_humid, day_4_humid, day_5_humid, day_6_humid, day_7_humid
    global day_1_precip, day_2_precip, day_3_precip, day_4_precip, day_5_precip, day_6_precip, day_7_precip

    request_w = requests.get(
        "https://api.weatherbit.io/v2.0/forecast/daily?city=Stourbridge&country=GB&days=7&key=API-KEY"
    )
    print("REQUESTED WEEK")
    request_d = requests.get(
        "https://api.weatherbit.io/v2.0/current?city=Stourbridge&country=GB&key=API-KEY"
    )
    print("REQUESTED DAY")
    data = json.loads(request_w.text)
    data_day = json.loads(request_d.text)

    cur_temp = data_day["data"][0]["temp"]
    sunris = data_day["data"][0]["sunrise"]
    sunst = data_day["data"][0]["sunset"]
    desc = data_day["data"][0]["weather"]["description"]

    icon = requests.get(
        f"https://www.weatherbit.io/static/img/icons/{data_day['data'][0]['weather']['icon']}.png",
        stream=True)
    icon_bin = icon.raw
    with open(f"{data_day['data'][0]['weather']['icon']}.png", "wb") as f:
        shutil.copyfileobj(icon_bin, f)

    weather_img = pyglet.image.load(
        f"{data_day['data'][0]['weather']['icon']}.png",
        decoder=PNGImageDecoder())
    main_temp.text = str(cur_temp) + "°C"
    temp_desc.text = desc
    sunrise.text = str(sunris)
    sunset.text = str(sunst)
    print("ALL CURRENT SETTINGS CHANGED")
    days = []
    for i in data["data"]:
        code = i["weather"]["icon"]
        desc = i["weather"]["description"]
        max_temp = str(i["max_temp"])
        min_temp = str(i["min_temp"])
        humid = str(round(i["rh"], 1)) + "%"
        precip = str(round(i["precip"], 1)) + "mm"
        days.append((code, desc, max_temp, min_temp, humid, precip))
        icon = requests.get(
            f"https://www.weatherbit.io/static/img/icons/{code}.png",
            stream=True)
        icon_bin = icon.raw
        with open(f"{code}.png", "wb") as f:
            shutil.copyfileobj(icon_bin, f)
        img = Image.open(f"{code}.png")
        img = img.resize((55, 55), Image.ANTIALIAS)
        img.save(f"{code}_compressed.png", quality=95)
        print("DAY DONE SAVING")

    for day in range(len(days)):
        if day == 0:
            day_1_icon = pyglet.image.load(f"{days[0][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_1_desc.text = days[0][1]
            if len(days[0][1]) > 10:
                day_1_desc.font_size = 12
            day_1_max.text = days[0][2]
            day_1_min.text = days[0][3]
            day_1_humid.text = days[0][4]
            day_1_precip.text = days[0][5]
            print("DAY 1 CHANGED")

        elif day == 1:
            day_2_icon = pyglet.image.load(f"{days[1][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_2_desc.text = days[1][1]
            if len(days[1][1]) > 10:
                day_2_desc.font_size = 12
            day_2_max.text = days[1][2]
            day_2_min.text = days[1][3]
            day_2_humid.text = days[1][4]
            day_2_precip.text = days[1][5]
            print("DAY 2 CHANGED")

        elif day == 2:
            day_3_icon = pyglet.image.load(f"{days[2][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_3_desc.text = days[2][1]
            if len(days[2][1]) > 10:
                day_3_desc.font_size = 12
            day_3_max.text = days[2][2]
            day_3_min.text = days[2][3]
            day_3_humid.text = days[2][4]
            day_3_precip.text = days[2][5]
            print("DAY 3 CHANGED")

        elif day == 3:
            day_4_icon = pyglet.image.load(f"{days[3][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_4_desc.text = days[3][1]
            if len(days[3][1]) > 10:
                day_4_desc.font_size = 12
            day_4_max.text = days[3][2]
            day_4_min.text = days[3][3]
            day_4_humid.text = days[3][4]
            day_4_precip.text = days[3][5]
            print("DAY 4 CHANGED")

        elif day == 4:
            day_5_icon = pyglet.image.load(f"{days[4][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_5_desc.text = days[4][1]
            if len(days[4][1]) > 10:
                day_5_desc.font_size = 12
            day_5_max.text = days[4][2]
            day_5_min.text = days[4][3]
            day_5_humid.text = days[4][4]
            day_5_precip.text = days[4][5]
            print("DAY 5 CHANGED")

        elif day == 5:
            day_6_icon = pyglet.image.load(f"{days[5][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_6_desc.text = days[5][1]
            if len(days[5][1]) > 10:
                day_6_desc.font_size = 12
            day_6_max.text = days[5][2]
            day_6_min.text = days[5][3]
            day_6_humid.text = days[5][4]
            day_6_precip.text = days[5][5]
            print("DAY 6 CHANGED")

        elif day == 6:
            day_7_icon = pyglet.image.load(f"{days[6][0]}_compressed.png",
                                           decoder=PNGImageDecoder())
            day_7_desc.text = days[6][1]
            if len(days[6][1]) > 10:
                day_7_desc.font_size = 12
            day_7_max.text = days[6][2]
            day_7_min.text = days[6][3]
            day_7_humid.text = days[6][4]
            day_7_precip.text = days[6][5]
            print("DAY 7 CHANGED")

    return cur_temp, desc
Beispiel #15
0
def test_pypng_loading(image_test, image_name):
    """Test loading PNG images using PyPNG."""
    from pyglet.image.codecs.png import PNGImageDecoder
    image_test.test_image_loading(PNGImageDecoder(), image_name)
Beispiel #16
0
 def test_pypng_load(self):
     from pyglet.image.codecs.png import PNGImageDecoder
     self._test_load(png_files, PNGImageDecoder(), True)
class TEST_PNG_LA_LOAD(base_load.TestLoad):
    texture_file = 'la.png'
    decoder = PNGImageDecoder()
Beispiel #18
0
 def load_image(self, fname):
     ''' Получить файл изображения
     '''
     from pyglet.image.codecs.png import PNGImageDecoder
     self.image = pyglet.image.load(fname, decoder=PNGImageDecoder())
Beispiel #19
0
def preview(expr,
            output='png',
            viewer=None,
            euler=True,
            packages=(),
            filename=None,
            outputbuffer=None,
            preamble=None,
            dvioptions=None,
            outputTexFile=None,
            **latex_settings):
    r"""
    View expression or LaTeX markup in PNG, DVI, PostScript or PDF form.

    If the expr argument is an expression, it will be exported to LaTeX and
    then compiled using the available TeX distribution.  The first argument,
    'expr', may also be a LaTeX string.  The function will then run the
    appropriate viewer for the given output format or use the user defined
    one. By default png output is generated.

    By default pretty Euler fonts are used for typesetting (they were used to
    typeset the well known "Concrete Mathematics" book). For that to work, you
    need the 'eulervm.sty' LaTeX style (in Debian/Ubuntu, install the
    texlive-fonts-extra package). If you prefer default AMS fonts or your
    system lacks 'eulervm' LaTeX package then unset the 'euler' keyword
    argument.

    To use viewer auto-detection, lets say for 'png' output, issue

    >>> from sympy import symbols, preview, Symbol
    >>> x, y = symbols("x,y")

    >>> preview(x + y, output='png')

    This will choose 'pyglet' by default. To select a different one, do

    >>> preview(x + y, output='png', viewer='gimp')

    The 'png' format is considered special. For all other formats the rules
    are slightly different. As an example we will take 'dvi' output format. If
    you would run

    >>> preview(x + y, output='dvi')

    then 'view' will look for available 'dvi' viewers on your system
    (predefined in the function, so it will try evince, first, then kdvi and
    xdvi). If nothing is found you will need to set the viewer explicitly.

    >>> preview(x + y, output='dvi', viewer='superior-dvi-viewer')

    This will skip auto-detection and will run user specified
    'superior-dvi-viewer'. If 'view' fails to find it on your system it will
    gracefully raise an exception.

    You may also enter 'file' for the viewer argument. Doing so will cause
    this function to return a file object in read-only mode, if 'filename'
    is unset. However, if it was set, then 'preview' writes the genereted
    file to this filename instead.

    There is also support for writing to a BytesIO like object, which needs
    to be passed to the 'outputbuffer' argument.

    >>> from io import BytesIO
    >>> obj = BytesIO()
    >>> preview(x + y, output='png', viewer='BytesIO',
    ...         outputbuffer=obj)

    The LaTeX preamble can be customized by setting the 'preamble' keyword
    argument. This can be used, e.g., to set a different font size, use a
    custom documentclass or import certain set of LaTeX packages.

    >>> preamble = "\\documentclass[10pt]{article}\n" \
    ...            "\\usepackage{amsmath,amsfonts}\\begin{document}"
    >>> preview(x + y, output='png', preamble=preamble)

    If the value of 'output' is different from 'dvi' then command line
    options can be set ('dvioptions' argument) for the execution of the
    'dvi'+output conversion tool. These options have to be in the form of a
    list of strings (see subprocess.Popen).

    Additional keyword args will be passed to the latex call, e.g., the
    symbol_names flag.

    >>> phidd = Symbol('phidd')
    >>> preview(phidd, symbol_names={phidd:r'\ddot{\varphi}'})

    For post-processing the generated TeX File can be written to a file by
    passing the desired filename to the 'outputTexFile' keyword
    argument. To write the TeX code to a file named
    "sample.tex" and run the default png viewer to display the resulting
    bitmap, do

    >>> preview(x + y, outputTexFile="sample.tex")


    """
    special = ['pyglet']

    if viewer is None:
        if output == "png":
            viewer = "pyglet"
        else:
            # sorted in order from most pretty to most ugly
            # very discussable, but indeed 'gv' looks awful :)
            # TODO add candidates for windows to list
            candidates = {
                "dvi": ["evince", "okular", "kdvi", "xdvi"],
                "ps": ["evince", "okular", "gsview", "gv"],
                "pdf": ["evince", "okular", "kpdf", "acroread", "xpdf", "gv"],
            }

            try:
                for candidate in candidates[output]:
                    path = find_executable(candidate)
                    if path is not None:
                        viewer = path
                        break
                else:
                    raise SystemError(
                        "No viewers found for '%s' output format." % output)
            except KeyError:
                raise SystemError("Invalid output format: %s" % output)
    else:
        if viewer == "file":
            if filename is None:
                SymPyDeprecationWarning(
                    feature="Using viewer=\"file\" without a "
                    "specified filename",
                    deprecated_since_version="0.7.3",
                    useinstead="viewer=\"file\" and filename=\"desiredname\"",
                    issue=7018).warn()
        elif viewer == "StringIO":
            SymPyDeprecationWarning(feature="The preview() viewer StringIO",
                                    useinstead="BytesIO",
                                    deprecated_since_version="0.7.4",
                                    issue=7083).warn()
            viewer = "BytesIO"
            if outputbuffer is None:
                raise ValueError("outputbuffer has to be a BytesIO "
                                 "compatible object if viewer=\"StringIO\"")
        elif viewer == "BytesIO":
            if outputbuffer is None:
                raise ValueError("outputbuffer has to be a BytesIO "
                                 "compatible object if viewer=\"BytesIO\"")
        elif viewer not in special and not find_executable(viewer):
            raise SystemError("Unrecognized viewer: %s" % viewer)

    if preamble is None:
        actual_packages = packages + ("amsmath", "amsfonts")
        if euler:
            actual_packages += ("euler", )
        package_includes = "\n" + "\n".join(
            ["\\usepackage{%s}" % p for p in actual_packages])

        preamble = r"""\documentclass[12pt]{article}
\pagestyle{empty}
%s

\begin{document}
""" % (package_includes)
    else:
        if len(packages) > 0:
            raise ValueError("The \"packages\" keyword must not be set if a "
                             "custom LaTeX preamble was specified")
    latex_main = preamble + '\n%s\n\n' + r"\end{document}"

    if isinstance(expr, str):
        latex_string = expr
    else:
        latex_string = latex(expr, mode='inline', **latex_settings)

    try:
        workdir = tempfile.mkdtemp()

        with io.open(join(workdir, 'texput.tex'), 'w', encoding='utf-8') as fh:
            fh.write(unicode(latex_main) % u_decode(latex_string))

        if outputTexFile is not None:
            shutil.copyfile(join(workdir, 'texput.tex'), outputTexFile)

        if not find_executable('latex'):
            raise RuntimeError("latex program is not installed")

        try:
            # Avoid showing a cmd.exe window when running this
            # on Windows
            if os.name == 'nt':
                creation_flag = 0x08000000  # CREATE_NO_WINDOW
            else:
                creation_flag = 0  # Default value
            check_output([
                'latex', '-halt-on-error', '-interaction=nonstopmode',
                'texput.tex'
            ],
                         cwd=workdir,
                         stderr=STDOUT,
                         creationflags=creation_flag)
        except CalledProcessError as e:
            raise RuntimeError(
                "'latex' exited abnormally with the following output:\n%s" %
                e.output)

        if output != "dvi":
            defaultoptions = {
                "ps": [],
                "pdf": [],
                "png": ["-T", "tight", "-z", "9", "--truecolor"],
                "svg": ["--no-fonts"],
            }

            commandend = {
                "ps": ["-o", "texput.ps", "texput.dvi"],
                "pdf": ["texput.dvi", "texput.pdf"],
                "png": ["-o", "texput.png", "texput.dvi"],
                "svg": ["-o", "texput.svg", "texput.dvi"],
            }

            if output == "svg":
                cmd = ["dvisvgm"]
            else:
                cmd = ["dvi" + output]
            if not find_executable(cmd[0]):
                raise RuntimeError("%s is not installed" % cmd[0])
            try:
                if dvioptions is not None:
                    cmd.extend(dvioptions)
                else:
                    cmd.extend(defaultoptions[output])
                cmd.extend(commandend[output])
            except KeyError:
                raise SystemError("Invalid output format: %s" % output)

            try:
                # Avoid showing a cmd.exe window when running this
                # on Windows
                if os.name == 'nt':
                    creation_flag = 0x08000000  # CREATE_NO_WINDOW
                else:
                    creation_flag = 0  # Default value
                check_output(cmd,
                             cwd=workdir,
                             stderr=STDOUT,
                             creationflags=creation_flag)
            except CalledProcessError as e:
                raise RuntimeError(
                    "'%s' exited abnormally with the following output:\n%s" %
                    (' '.join(cmd), e.output))

        src = "texput.%s" % (output)

        if viewer == "file":
            if filename is None:
                buffer = BytesIO()
                with open(join(workdir, src), 'rb') as fh:
                    buffer.write(fh.read())
                return buffer
            else:
                shutil.move(join(workdir, src), filename)
        elif viewer == "BytesIO":
            with open(join(workdir, src), 'rb') as fh:
                outputbuffer.write(fh.read())
        elif viewer == "pyglet":
            try:
                from pyglet import window, image, gl
                from pyglet.window import key
            except ImportError:
                raise ImportError(
                    "pyglet is required for preview.\n visit http://www.pyglet.org/"
                )

            if output == "png":
                from pyglet.image.codecs.png import PNGImageDecoder
                img = image.load(join(workdir, src), decoder=PNGImageDecoder())
            else:
                raise SystemError("pyglet preview works only for 'png' files.")

            offset = 25

            config = gl.Config(double_buffer=False)
            win = window.Window(width=img.width + 2 * offset,
                                height=img.height + 2 * offset,
                                caption="sympy",
                                resizable=False,
                                config=config)

            win.set_vsync(False)

            try:

                def on_close():
                    win.has_exit = True

                win.on_close = on_close

                def on_key_press(symbol, modifiers):
                    if symbol in [key.Q, key.ESCAPE]:
                        on_close()

                win.on_key_press = on_key_press

                def on_expose():
                    gl.glClearColor(1.0, 1.0, 1.0, 1.0)
                    gl.glClear(gl.GL_COLOR_BUFFER_BIT)

                    img.blit((win.width - img.width) / 2,
                             (win.height - img.height) / 2)

                win.on_expose = on_expose

                while not win.has_exit:
                    win.dispatch_events()
                    win.flip()
            except KeyboardInterrupt:
                pass

            win.close()
        else:
            try:
                # Avoid showing a cmd.exe window when running this
                # on Windows
                if os.name == 'nt':
                    creation_flag = 0x08000000  # CREATE_NO_WINDOW
                else:
                    creation_flag = 0  # Default value
                check_output([viewer, src],
                             cwd=workdir,
                             stderr=STDOUT,
                             creationflags=creation_flag)
            except CalledProcessError as e:
                raise RuntimeError(
                    "'%s %s' exited abnormally with the following output:\n%s"
                    % (viewer, src, e.output))
    finally:
        try:
            shutil.rmtree(workdir)  # delete directory
        except OSError as e:
            if e.errno != 2:  # code 2 - no such file or directory
                raise
Beispiel #20
0
 def load_images(self):
     for name, path in self.resources.items():
         self.images[name] = pyglet.image.load(path,
                                               decoder=PNGImageDecoder())
Beispiel #21
0
import pyglet
import sys
kitten_stream = open('kitten.png', 'rb')  #birinci resim
kitten = pyglet.image.load('kitten.png', file=kitten_stream)

from pyglet.image.codecs.png import PNGImageDecoder
kitten = pyglet.image.load('kitten.png', decoder=PNGImageDecoder())

image_part = kitten.get_region(x=10, y=10, width=100, height=100)
sprite1 = pyglet.sprite.Sprite(img=kitten)

kitten_stream = open('kitten.png', 'rb')  #ikinci resim
kitten = pyglet.image.load('kitten.png', file=kitten_stream)

from pyglet.image.codecs.png import PNGImageDecoder
kitten = pyglet.image.load('kitten.png', decoder=PNGImageDecoder())

image_part = kitten.get_region(x=10, y=60, width=100, height=100)
sprite2 = pyglet.sprite.Sprite(img=kitten)

window = pyglet.window.Window()
window = pyglet.window.Window(fullscreen=True)


class Timer(object):
    def __init__(self):
        self.label = pyglet.text.Label('DNA',
                                       font_size=16,
                                       x=window.width // 2,
                                       y=window.height // 2,
                                       anchor_x='center',
Beispiel #22
0
center_x = window.width // 2
center_y = window.height // 2
font_size = 22

label = pyglet.text.Label('Hello, WORLD!',
                          font_name='Verdana',
                          font_size=font_size,
                          color=(160, 60, 60, 254),
                          x=center_x,
                          y=center_y,
                          anchor_x='center',
                          anchor_y='center')

fname = 'pennant.png'
from pyglet.image.codecs.png import PNGImageDecoder
img_pennant = pyglet.image.load(fname, decoder=PNGImageDecoder())

orto_cube = [
    100,
    100,
    100,
    200,
    100,
    100,
    200,
    200,
    100,
    100,
    200,
    100,
    100,
Beispiel #23
0
 def load_overlay(self):
     '''Load the overlay'''
     overlay_file = self.cp.get(self.name, 'overlay_image')
     # set the encode explicitly otherwise we get in trouble with the image_data format
     overlay_image = pyglet.image.load(os.path.join('cups', self.cup, overlay_file), decoder=PNGImageDecoder())
     image_data = overlay_image.get_image_data()
     data = image_data.get_data('RGBA', image_data.pitch)
     self.overlay_data = map(ord, list(data))
Beispiel #24
0
                return buffer
            else:
                shutil.move(join(workdir,src), filename)
        elif viewer == "StringIO":
            with open(join(workdir, src), 'rb') as fh:
                outputbuffer.write(fh.read())
        elif viewer == "pyglet":
            try:
                from pyglet import window, image, gl
                from pyglet.window import key
            except ImportError:
                raise ImportError("pyglet is required for plotting.\n visit http://www.pyglet.org/")

            if output == "png":
                from pyglet.image.codecs.png import PNGImageDecoder
                img = image.load(join(workdir, src), decoder=PNGImageDecoder())
            else:
                raise SystemError("pyglet preview works only for 'png' files.")

            offset = 25

            win = window.Window(
                width=img.width + 2*offset,
                height=img.height + 2*offset,
                caption="sympy",
                resizable=False
            )

            win.set_vsync(False)

            try:
Beispiel #25
0
    def render(self, store_video=False, video_identifier=1,  mode='human'):
        """
        Renders the simulation
        :param store_video: bool to save screenshots or not
        :param video_identifier: number to label video of this simulation
        :param mode: inherited from gym, currently not used
        """
        
        # Constant values of window size, sprite sizes, etc... 
        screen_width = 600
        screen_height = 600
        scale = 30.0
        object_width = 50
        object_height = 50
        sprite_scale = 0.4
        sprite_width = 350 * sprite_scale
        sprite_height = 350 * sprite_scale
        agent_scale = 1.0
        patient_scale = 1.0
        
        if self.viewer is None:
            # we create a new viewer (window)
            self.viewer = rendering.Viewer(screen_width, screen_height)
            
            # visualizing the agent
            l, r, t, b = -object_width / 2, object_width / 2, object_height / 2, -object_height / 2
            agent_polygon = rendering.FilledPolygon([(l, b), (l, t), (r, t), (r, b)])
            self.agent_geom = agent_polygon
            self.agent_trans = rendering.Transform()
            rand_color = self._create_color(for_agent=True)
            agent_polygon.set_color(rand_color[0], rand_color[1], rand_color[2])
            agent_polygon.add_attr(self.agent_trans)
            agent_sprite_file = self._determine_sprites(self.agent_color)
            agent_image = pyglet.image.load(agent_sprite_file, decoder=PNGImageDecoder())
            agent_sprite = pyglet.sprite.Sprite(img=agent_image)
            glEnable(GL_TEXTURE_2D)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
            agent_sprite.scale = sprite_scale
            sprite_geom = rendering.SpriteGeom(agent_sprite)
            self.viewer.add_geom(sprite_geom)
            self.agent_sprite_geom = sprite_geom
            self.agent_sprite_trans = rendering.Transform()
            sprite_geom.add_attr(self.agent_sprite_trans)

            # hand and claw receives additional sprite for grasping (thumb above object)
            if self.agent_color == self.hand_color or self.agent_color == self.claw_color:
                thumb_image = pyglet.image.load(self._determine_extra_sprites(self.agent_color == self.hand_color),
                                                decoder=PNGImageDecoder())
                thumb_sprite = pyglet.sprite.Sprite(img=thumb_image)
                thumb_sprite.scale = sprite_scale
                self.agent_sprite_extra_geom = rendering.SpriteGeom(thumb_sprite)
                self.viewer.add_geom(self.agent_sprite_extra_geom)
                self.agent_sprite_extra_trans = rendering.Transform()
                self.agent_sprite_extra_geom.add_attr(self.agent_sprite_extra_trans)

            # visualize the patient
            patient_polygon = rendering.FilledPolygon([(l, b), (l, t), (r, t), (r, b)])
            self.patient_geom = patient_polygon
            self.patient_trans = rendering.Transform()
            patient_polygon.add_attr(self.patient_trans)
            rand_color = self._create_color(for_agent=False)
            patient_polygon.set_color(rand_color[0], rand_color[1], rand_color[2])
            patient_sprite_file = self._determine_sprites(self.patient_color)
            patient_image = pyglet.image.load(patient_sprite_file, decoder=PNGImageDecoder())
            patient_sprite = pyglet.sprite.Sprite(img=patient_image)
            glEnable(GL_TEXTURE_2D)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
            patient_sprite.scale = sprite_scale
            sprite_geom2 = rendering.SpriteGeom(patient_sprite)
            self.viewer.add_geom(sprite_geom2)
            self.patient_sprite_geom = sprite_geom2
            self.patient_sprite_trans = rendering.Transform()
            sprite_geom2.add_attr(self.patient_sprite_trans)

            # the ongoing event is displayed through a sprite in the top left corner
            event_img = pyglet.image.load('Sprites/still.png', decoder=PNGImageDecoder())
            event_sprite = pyglet.sprite.Sprite(img=event_img)
            self.current_event_sprite = rendering.SpriteGeom(event_sprite)
            self.current_event_sprite.set_z(-1)
            self._load_event_sprite()
            current_event_sprite_transform = rendering.Transform()
            current_event_sprite_transform.set_translation(0, screen_height-50)
            self.current_event_sprite.add_attr(current_event_sprite_transform)
            self.viewer.add_geom(self.current_event_sprite)

            # The current gaze position is visualized by a small red dot
            fixation_file = pyglet.image.load('Sprites/redDot.png', decoder=PNGImageDecoder())
            fixation_sprite = pyglet.sprite.Sprite(img=fixation_file)
            fixation_sprite.scale = 0.1
            self.gaze_geom = rendering.SpriteGeom(fixation_sprite)
            self.gaze_trans = rendering.Transform()
            self.gaze_geom.add_attr(self.gaze_trans)
            self.viewer.add_geom(self.gaze_geom)

            # background image (only needed for having nice videos)
            if store_video:
                background_img = pyglet.image.load('Sprites/background.png', decoder=PNGImageDecoder())
                background_sprite = pyglet.sprite.Sprite(img=background_img)
                background_sprite.scale = 1
                self.background_geom = rendering.SpriteGeom(background_sprite)
                self.background_geom.set_z(-10)
                self.background_trans = rendering.Transform()
                self.background_geom.add_attr(self.background_trans)
                self.background_trans.set_translation(0, 0)
                self.viewer.add_geom(self.background_geom)

        # during video recording images of the simulation are saved
        if store_video:
            self.viewer.activate_video_mode("Video" + str(video_identifier) + "/")

        # determine the sprite positions, sizes and orientations:
        agent_x = self.agent_pos[0] * scale + (screen_width / 2.0)
        agent_y = self.agent_pos[1] * scale + (screen_height / 2.0)
        patient_x = self.patient_pos[0] * scale + (screen_width / 2.0)
        patient_y = self.patient_pos[1] * scale + (screen_height / 2.0)
        gaze_x = self.gaze_pos[0] * scale + (screen_width / 2.0)
        gaze_y = self.gaze_pos[1] * scale + (screen_height / 2.0)
        self.gaze_trans.set_translation(gaze_x, gaze_y)
        self.gaze_geom.set_z(11)
        agent_scale += self.agent_pos[2]/10 * 2
        patient_scale += self.patient_pos[2]/10 * 2
        self.agent_geom.set_z(self.agent_pos[2] - 2)
        self.patient_geom.set_z(self.patient_pos[2])
        self.agent_sprite_geom.set_z(self.agent_pos[2] - 2)
        self.patient_sprite_geom.set_z(self.patient_pos[2] + 0.25)
        self.agent_sprite_trans.set_rotation(self.agent_sprite_orientation)
        if self.agent_sprite_extra_geom:
            self.agent_sprite_extra_geom.set_z(self.agent_pos[2] + 2)
            self.agent_sprite_extra_trans.set_rotation(self.agent_sprite_orientation)

        # compute the rotation matrix for correction
        theta = self.agent_sprite_orientation
        r = np.array(((np.cos(theta), -np.sin(theta)),
                      (np.sin(theta), np.cos(theta))))
        sprite_center = np.array([agent_scale*sprite_width/2.0, agent_scale*sprite_height/2.0])
        new_sprite_center = np.dot(r, sprite_center)
        self.agent_trans.set_translation(agent_x, agent_y)
        self.agent_sprite_trans.set_translation(agent_x - new_sprite_center[0], agent_y - new_sprite_center[1])
        self.patient_sprite_trans.set_translation(patient_x - patient_scale*sprite_width/2.0,
                                                  patient_y - patient_scale*sprite_height/2.0)
        if self.agent_sprite_extra_geom:
            self.agent_sprite_extra_trans.set_translation(agent_x - new_sprite_center[0],
                                                          agent_y - new_sprite_center[1])
            self.agent_sprite_extra_trans.set_scale(agent_scale, agent_scale)
        self.patient_trans.set_translation(patient_x, patient_y)
        self.agent_trans.set_scale(agent_scale, agent_scale)
        self.agent_sprite_trans.set_scale(agent_scale, agent_scale)
        self.patient_sprite_trans.set_scale(patient_scale, patient_scale)
        self.patient_trans.set_scale(patient_scale, patient_scale)

        return self.viewer.render(mode == 'rgb_array')
class TEST_PNG_INDEXED_LOAD(base_load.TestLoad):
    texture_file = 'rgb_8bpp.png'
    decoder = PNGImageDecoder()
#!/usr/bin/env python

'''Test RGB load using PIL, decoder is not available and PYPNG decoder
is used.  You should see the rgb.png image on a checkboard background.
'''

__docformat__ = 'restructuredtext'
__version__ = '$Id: $'

import unittest
import base_load

from pyglet.image.codecs.pil import Image, PILImageDecoder
from pyglet.image.codecs.png import PNGImageDecoder
from pyglet.image import codecs

def raise_error(obj, param):
    raise Exception()
Image.Image.transpose = raise_error

codecs.get_decoders = lambda filename: [PILImageDecoder(), PNGImageDecoder(),]

class TEST_PIL_RGB_LOAD_NO_DECODER(base_load.TestLoad):
    texture_file = 'rgb.png'
    decoder = None

if __name__ == '__main__':
    unittest.main()