def resize_store(store, shape, cache=False, exclude=[None], verbose=True, name=None): """A new store that contains resized images from _store_. """ if verbose: print "Resizing store", store, "to new shape", shape if name is None: print "Generating store name by hashing." sfn = store.filename.split(".")[0] name = hashlib.sha1(sfn + str(shape)) name = name.hexdigest()[:8] + ".resz.h5" else: print "Store name is given:", name if cache is True and exists(name): if verbose: print "Using cached version ", name return h5py.File(name, 'r+') print "No cache, writing to", name rsz = h5py.File(name, 'w') helpers.resize(store, rsz, shape, exclude=exclude) rsz.attrs["Resized"] = "from " + str(store.filename) return rsz
def __init__(self, root=None, objeto=Animal()): super().__init__(root) self.label = tk.Label(self, text='Detalles') self.label.config(anchor=tk.CENTER, pady=10, bg='gray', width=45) self.label.pack(side=tk.TOP) ################################################################################################# self.body = tk.Frame(self) self.body.config(width=248, height=330) self.body.pack(side=tk.BOTTOM) """ FOTO DEL ANIMAL """ self.photo = tk.PhotoImage(file=objeto.urlImage) self.photo = resize(self.photo, 120, 120) self.labelPhoto = tk.Label(self.body, image=self.photo, bg=grisOscuro) self.labelPhoto.place(x=0, y=0) self.descripcion = tk.Text(self.body) self.descripcion.config(width=70, height=11) self.descripcion.insert(tk.INSERT, objeto.descripcion) self.descripcion.place(x=0, y=150) ################################################################################################# self.button = tk.Button(self.body, text='Back') self.button.place(x=100, y=280) self.button.bind('<Button-1>', lambda e: root.handleBackDetalles(e))
def __init__( self, root = None, file = '', text = '', x = 0, y = 0, data = [] ): super().__init__(root) self.data = data width = 120 height = 120 self.photo = tk.PhotoImage(file = file) self.photo = resize( self.photo, width , height ) self.img = tk.Label(self, image = self.photo, bg = grisMedio) self.label = tk.Label(self, text = text) self.label.config(anchor = tk.CENTER, pady= 10, bg = grisClaro, width = 16) self.img.pack( side = tk.TOP) self.label.pack( side = tk.BOTTOM ) self.place(x = x , y = y) self.img.bind('<Button-1>', lambda e: root.handleClickImage(e,self.data)) self.label.bind('<Button-1>', lambda e: root.handleClickImage(e,self.data))
def resize_store(store, shape, cache=False): """A new store that contains stationary images from _store_. """ print "Resizing store", store, "to new shape", shape sfn = store.filename.split(".")[0] name = hashlib.sha1(sfn + str(shape)) name = name.hexdigest()[:8] + ".resz.h5" if cache is True and exists(name): print "Using cached version ", name return h5py.File(name, 'r+') print "No cache, writing to", name rsz = h5py.File(name, 'w') helpers.resize(store, rsz, shape) rsz.attrs["Resized"] = "from " + str(store.filename) return rsz
def setDescription(self, objeto=Animal()): #print(objeto.urlImage) self.photo = tk.PhotoImage(file=objeto.urlImage) self.photo = resize(self.photo, 120, 120) self.labelPhoto.config(image=self.photo) self.labelPhoto.place(x=65, y=10) self.descripcion.delete('1.0', tk.END) self.descripcion.insert(tk.INSERT, objeto.descripcion)
def __init__(self, root=None, file='', text='', x=0, y=0, data=[]): super().__init__(root) self.data = data width = 50 height = 50 self.photo = tk.PhotoImage(file=file) self.photo = resize(self.photo, width, height) self.img = tk.Label(self, image=self.photo, bg=grisOscuro) self.img.pack(side=tk.TOP) self.place(x=x, y=y) self.img.bind('<Button-1>', lambda e: root.handleClickImage2(e, self.data))
def __init__(self, root=None, imagen="", gift=""): super().__init__(root) self.imagen = imagen self.gift = gift self.body = tk.Frame(self) self.body.config(width=648, height=430) self.body.pack(side=tk.BOTTOM) """ FOTO DEL ANIMAL """ self.photo = tk.PhotoImage(file=imagen) self.photo = resize(self.photo, 600, 400) self.labelPhoto = tk.Label(self.body, image=self.photo, bg=grisClaro) self.labelPhoto.place(x=30, y=15) ################################################################################################# self.button = tk.Button(self.body, text='Ok') self.button.place(x=300, y=380) self.button.bind('<Button-1>', lambda e: root.handleBackDetalles2(e))
def setDescription(self, objeto=Animal()): print(objeto.urlImage) self.photo = tk.PhotoImage(file=objeto.urlImage) self.photo = resize(self.photo, 120, 120) self.labelPhoto.config(image=self.photo) self.labelPhoto.place(x=65, y=10)