def __init__(self): StandardWindow.__init__(self, "ex5", "Static Image", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) ourImage = Image(self) ourImage.size_hint_weight = EXPAND_BOTH ourImage.file_set("images/logo.png") ourImage.tooltip_text_set("A picture!") ourImage.show() self.resize_object_add(ourImage)
class PictureFrame(Frame): def __init__(self, parent_widget, ourText=None, image=None, *args, **kwargs): Frame.__init__(self, parent_widget, *args, **kwargs) self.text = ourText self.ourImage = Image(self) self.ourImage.size_hint_weight = EXPAND_BOTH if image: self.ourImage.file_set(image) self.content_set(self.ourImage) def file_set(self, image): self.ourImage.file_set(image)
def image_clicked(obj): win = StandardWindow("image", "Image test", autodel=True, size=(320, 480)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.resize_object_add(vbox) vbox.show() im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, file=os.path.join(img_path, "logo.png")) vbox.pack_end(im) im.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() for rot in orients: b = Button(win, text=rot[0]) hbox.pack_end(b) b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y)) b.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() b = Button(win, text="Set remote URL") hbox.pack_end(b) b.callback_clicked_add(lambda b: im.file_set(remote_url)) b.show() pb = Progressbar(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) hbox.pack_end(pb) pb.show() im.callback_download_start_add(_cb_im_download_start, pb) im.callback_download_done_add(_cb_im_download_done) im.callback_download_progress_add(_cb_im_download_progress, pb) im.callback_download_error_add(_cb_im_download_error, pb) win.show()