Exemplo n.º 1
0
def pick_image00():
    global num,names,f_file_log,f_file00
    f_file_log=open('Z:110110/code/log.txt','w')
    f_file_log.write(str(num))
    f_file00.open('Z:110110/code/pick00.txt')
    f_file00.write(img_list[num])
    f_file00.write('\n')
    f_file00.close()
    del names['path'+str(num)]
    del names['pilimage'+str(num)]
    del names['im_w'+str(num)]
    del names['im_h'+str(num)]
    del names['img'+str(num)]
    num = num +1
    if(num>length-1):
        tk.messagebox.showinfo(title='提示',message='已经没有了!')
    else:
        names['path'+str(num)] = img_list[num]
        names['pilimage'+str(num)] = Image.open(names['path'+str(num)])
        names['im_w'+str(num)] = names['pilimage'+str(num)].size[0]
        names['im_h'+str(num)] = names['pilimage'+str(num)].size[1]
        alpha = names['im_h'+str(num)]/names['im_w'+str(num)]
        names['pilimage'+str(num)] = names['pilimage'+str(num)].resize((int(120*alpha),120))
        names['img'+str(num)] = ImageTK.PhotoImage(names['pilimage'+str(num)])
        imLabel.configure(image=names['img'+str(num)])
        txLabel.configure(text='No: '+str(num))
        nm_en.delete(0,END)
        nm_en.insert(0,img_list[num].split('/')[-1])
        nm_en1.delete(0,END)
        nm_en1.insert(0,img_list[num].split('\\')[-1])
Exemplo n.º 2
0
 def __init__(self, name, path, img):
     self.name = name
     self.path = path
     if os.path.isdir(path):
         self.img = ImageTk.PhotoImage(
             Image.open('../Lib/img/directory.png'))
     else:
         self.img = ImageTK.PhotoImage(Image.open('../Lib/img/file.png'))
     frame = tk.Frame(master)
Exemplo n.º 3
0
    def resize(self, event):
        sc = self.canvas
        sc.delete(ALL)  # erase the whole canvas
        width = sc.winfo_width()
        height = sc.winfo_height()

        imgSize = min(width, height)
        self.pad = imgSize / 16
        viewport = (self.pad, self.pad, width - self.pad, height - self.pad)
        self.T = mapper(self.world, viewport)

        if self.showImage:
            flu = self.fluImg.resize(
                (int(0.8 * 0.8 * imgSize), int(0.8 * imgSize)),
                Image.ANTIALIAS)
            self.flu = ImageTK.PhotoImage(flu)
            sc.create_image(width / 2, height / 2, image=self.flu)
        else:
            self.canvas.create_rectangle([[0, 0], [width, height]],
                                         fill=self.bgcolor)

        self.redraw()  # redraw the clock
from PIL import ImageTK, Image
import tkinter as tk
from tkinter import messagebox

win = tk.TK()
win.title('Instagram Image Downloader')

def imgDownload():
    ig = instaloader.instaloader()
    profile = entry.get()
    ig.download_profile(profile, profile_pic_only=True)
    messagebox.showinfo()("Status", "Image Downloader Succesfully")
    
img = Image.open("ig.png")
img = img.resize((200, 200), Image.ANTIALIAS)
resized_img = ImageTK.PhotoImage(img)

title = tk.Lable(win, text ="Instagram Image Downloader", font=("Times", 20, "bold"))

title.grid(row=0, column=0, columnspan=5, padx=30, pady=10)

image = tk.Label(win, image=resized_img)
image.grid(row=2, column=0, columnspan=5, pady=20)

lable =tk.Label(win, text="Enter Username: "******"Arial", 10))
lable.grid(row=3, column=1, columnspan=3)

btn = tk.Entry(win, width=40)
entry.grid(row=3, column=1, columnspan=3)

btn = tk.Button(win, text="Download", command=imgDownload)
Exemplo n.º 5
0
txLabel.place(x=10,y=570,width=120,height=30)
nm_en = Entry(root,textvariable=str_v1)
nm_en['background']='mintcream'
nm_en.insert(0,img_list[num])
nm_en.place(x=10,y=630,width=120,height=30)
 
nm_en1 = Entry(root,textvariable=str_v1)
nm_en1['background']='mintcream'
nm_en1.insert(0,img_list[num].split('\\')[-1])
nm_en1.place(x=10,y=730,width=120,height=30)
 
frame = tk.Frame(root,width=100,height=100,background='pink')
frame.bind('<Key>',key)
frame.place(x=10,y=800,width=120,height=30)
frame.focus_set()
 
txLabel1 = tk.Label(root,text='Total: '+str(length))
txLabel1['background']='mintcream'
txLabel1.place(x=10,y=600,width=120,height=30)
names['path'+str(num)] = img_list[num]
names['pilimage'+str(num)] = Image.open(names['path'+str(num)])
names['im_w'+str(num)] = names['pilimage'+str(num)].size[0]
names['im_h'+str(num)] = names['pilimage'+str(num)].size[1]
alpha = names['im_h'+str(num)]/names['im_w'+str(num)]
names['pilimage'+str(num)] = names['pilimage'+str(num)].resize((int(120*alpha),120))
names['img'+str(num)] = ImageTK.PhotoImage(names['pilimage'+str(num)])
imLabel=tk.Label(root,image=names['img'+str(num)],width = 800,height=350)
imLabel['background']='mintcream'
imLabel.pack()
root.mainloop()