Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_image(self):
if self.texture_file:
self.texture_file = join(test_data_path, self.texture_file)
self.image = image.load(self.texture_file, decoder=self.decoder)
def test_set_icon_sizes(self):
self.width, self.height = 200, 200
self.w = w = Window(self.width, self.height)
try:
w.set_icon(image.load(self.get_test_data_file('images', 'icon_size1.png')),
image.load(self.get_test_data_file('images', 'icon_size2.png')),
image.load(self.get_test_data_file('images', 'icon_size3.png')),
image.load(self.get_test_data_file('images', 'icon_size4.png')),
image.load(self.get_test_data_file('images', 'icon_size5.png')))
w.dispatch_events()
self.user_verify('Does the window have the icon corresponding to the correct size?', take_screenshot=False)
finally:
w.close()
def __init__(self, fname, width, height):
Geom.__init__(self)
self.width = width
self.height = height
img = pyglet.image.load(fname)
self.img = img
self.flip = False
def render1(self):
def _set_icon(self, icon):
if icon is None:
self._icon = None
self._iconname = ''
else:
self._iconname = icon
img = pyglet.image.load('icons/%s.png' % icon)
self._icon = pyglet.sprite.Sprite(img)
def _get_icon(self):
def __init__(self):
# A Batch is a collection of vertex lists for batched rendering.
self.batch = pyglet.graphics.Batch()
# A TextureGroup manages an OpenGL texture.
self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
# A mapping from position to the texture of the block at that position.
# This defines all the blocks that are currently in the world.
self.world = {}
# Same mapping as `world` but only contains blocks that are shown.
self.shown = {}
# Mapping from position to a pyglet `VertextList` for all shown blocks.
self._shown = {}
# Mapping from sector to a list of positions inside that sector.
self.sectors = {}
# Simple function queue implementation. The queue is populated with
# _show_block() and _hide_block() calls
window.push_handlers(pyglet.window.event.WindowEventLogger())
pyglet.resource.path = ['images', 'sounds']
pyglet.resource.reindex()
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
window.set_visible()
#images
securityofficenimg = pyglet.image.load(os.path.join("images", "sec.png"), decoder=PNGImageDecoder())
leftbuttonimg = pyglet.image.load(os.path.join("images", "lb.png"), decoder=PNGImageDecoder())
leftbuttonimgdoorclosed = pyglet.image.load(os.path.join("images", "lbdc.png"), decoder=PNGImageDecoder())
leftbuttonimgbothclosed = pyglet.image.load(os.path.join("images", "lbb.png"), decoder=PNGImageDecoder())
leftbuttonimglight = pyglet.image.load(os.path.join("images", "lbl.png"), decoder=PNGImageDecoder())
rightbuttonimg = pyglet.image.load(os.path.join("images", "rb.png"), decoder=PNGImageDecoder())
rightbuttonimgdoorclosed = pyglet.image.load(os.path.join("images", "rbdc.png"), decoder=PNGImageDecoder())
rightbuttonimgbothclosed = pyglet.image.load(os.path.join("images", "rbb.png"), decoder=PNGImageDecoder())
rightbuttonimglight = pyglet.image.load(os.path.join("images", "rbl.png"), decoder=PNGImageDecoder())
cambuttonimg = pyglet.image.load(os.path.join("images", "cambutton.png"), decoder=PNGImageDecoder())
honk = pyglet.resource.media(os.path.join("sounds", "freddyhonk.wav"), streaming=False)
background = pyglet.sprite.Sprite(securityofficenimg, 0, 0)
leftbutton = pyglet.sprite.Sprite(leftbuttonimg, 1, 180)
rightbutton = pyglet.sprite.Sprite(rightbuttonimg, 1475, 180)
cambutton = pyglet.sprite.Sprite(cambuttonimg, 500, 40)
super_mario = {'walk':\
[pyglet.image.load('../sprites/heroes/mario/super/walk_0.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_1.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_2.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_3.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_4.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_5.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_6.png'),\
pyglet.image.load('../sprites/heroes/mario/super/walk_7.png')],\
'jump':\
[pyglet.image.load('../sprites/heroes/mario/super/jump_0.png')],\
'attack':\
[pyglet.image.load('../sprites/heroes/mario/super/attack_0.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_1.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_2.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_3.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_4.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_5.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_6.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_7.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_8.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_9.png'),\
pyglet.image.load('../sprites/heroes/mario/super/attack_10.png')],\
'dash':\
[pyglet.image.load('../sprites/heroes/mario/super/dash_0.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_1.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_2.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_3.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_4.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_5.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_6.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_7.png')],\
#!/usr/bin/env python
import pyglet
image_stream = open("gnome-globe.png", "rb")
image = pyglet.image.load('gnome-globe.png', file=image_stream)
print("Loaded image with size %d x %d pixels" % (image.width, image.height))
def __init__(self):
self.my_batch = pyglet.graphics.Batch()
self.all_images = [
pyglet.image.load("square-1.png"),
pyglet.image.load("square-2.png"),
pyglet.image.load("square-3.png"),
pyglet.image.load("square-4.png"),
pyglet.image.load("square-5.png"),
]
self.all_sprites = []
self.render()
'dash':\
[pyglet.image.load('../sprites/heroes/mario/super/dash_0.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_1.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_2.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_3.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_4.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_5.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_6.png'),\
pyglet.image.load('../sprites/heroes/mario/super/dash_7.png')],\
'swim':\
[pyglet.image.load('../sprites/heroes/mario/super/swim_0.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_1.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_2.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_3.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_4.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_5.png'),\
pyglet.image.load('../sprites/heroes/mario/super/swim_6.png')],\
'duck':\
[pyglet.image.load('../sprites/heroes/mario/super/duck_0.png')]}
fire_mario = {}
ice_mario = {}
racoon_mario = {}
tanooki_mario = {}
propeller_mario = {}
penguin_mario = {}