def __init__(self, img_name=''): super(RenderAsteroidEcsComponent, self).__init__() if img_name: self.spr = pyglet.sprite.Sprite(img.get(img_name)) else: self.spr = None
def __init__(self): super(RenderShipEcsComponent, self).__init__() self.spr = pyglet.sprite.Sprite(img.get(img.IMG_SHIP)) self.thrust_spr = pyglet.sprite.Sprite(anim.get(anim.ANIM_THRUST)) self.thrust_cooldown = 0
def __init__(self, img_name=''): super(RenderPlanetEcsComponent, self).__init__() if img_name: print 'img name: ', img_name self.spr = pyglet.sprite.Sprite(img.get(img_name)) else: self.spr = None
def run(self): while 1: api_key = "GetYourOwnKey!" url = "http://api.flickr.com/services/rest/?method=flickr.photos.getRecent&per_page=10&api_key=" + api_key result = urllib2.urlopen(url) tree = ET.fromstring(result.read()) img = tree.findall("./photos/photo[@secret]")[0] # imageURL = "http://farm%s.staticflickr.com/%s/%s_%s_o.%s" % (img.get('farm'), img.get('server'), img.get('id'), img.get('originalsecret'), img.get('originalformat')) imageURL = "http://farm%s.staticflickr.com/%s/%s_%s_b.jpg" % ( img.get("farm"), img.get("server"), img.get("id"), img.get("secret"), ) urllib.urlretrieve(imageURL, "temp.jpg") self.resize_img("temp.jpg") time.sleep(30)
async def get_img(request, collection, name): return response.raw(img.get(os.path.join(collection, name), "gif"), headers={"Content-Type": f"image/gif"})
async def get_img(request, name): return response.raw(img.get(f"{name}", "gif"), headers={"Content-Type": f"image/gif"})