コード例 #1
0
 def on_text(self, text):
     if text != 's': return pyglet.window.event.EVENT_UNHANDLED
     image = pyglet.image.BufferImage().get_raw_image()
     fn = filename + '.png'
     n = 1
     while os.path.exists(fn):
         fn = filename + str(n) + '.png'
         n += 1
     print "Saving to '%s'"%fn
     image.save(fn)
コード例 #2
0
def take_screenshot(window):
    """This is your registered on_key_press handler.

    window is the pyglet.window.Window object to grab.
    """
    gl.glPixelTransferf(gl.GL_ALPHA_BIAS, 1.0)  # don't transfer alpha channel
    image = pyglet.image.ColorBufferImage(0, 0, window.width, window.height)
    image.save(screenshot_path())
    gl.glPixelTransferf(gl.GL_ALPHA_BIAS,
                        0.0)  # restore alpha channel transfer
コード例 #3
0
ファイル: screenshot.py プロジェクト: rdb/what-the-frog
def take_screenshot(window, path=None):
    """Take a screenshot of the given window.

    Save it to a new path returned by screenshot_path.

    """
    # disable transfer alpha channel
    gl.glPixelTransferf(gl.GL_ALPHA_BIAS, 1.0)
    image = pyglet.image.ColorBufferImage(0, 0, window.width, window.height)
    image.save(path or screenshot_path())
    # re-enable alpha channel transfer
    gl.glPixelTransferf(gl.GL_ALPHA_BIAS, 0.0)
コード例 #4
0
ファイル: win32.py プロジェクト: ematvey/NanoEngineer-1
def _debug_image(image, name):
    filename = _debug_filename(name, 'png')
    image.save(filename)
    _debug('Saved image %r to %s' % (image, filename))
コード例 #5
0
ファイル: win32.py プロジェクト: MUSANGTARA0/pyglet
def _debug_image(image, name):
    filename = _debug_filename(name, 'png')
    image.save(filename)
    _debug('Saved image %r to %s' % (image, filename))
コード例 #6
0
ファイル: win32.py プロジェクト: rkern/sympy-rkern
def _debug_image(image, name):
    filename = _debug_filename(name, "png")
    image.save(filename)
    _debug("Saved image %r to %s" % (image, filename))