|
|
|
|
@ -18,25 +18,41 @@ class ProjectLiferFrame(Frame): |
|
|
|
|
self.butselall = Button(self, text='Alle wählen', command=self.select_all) |
|
|
|
|
self.butselnone = Button(self, text='Keine wählen', command=self.select_none) |
|
|
|
|
|
|
|
|
|
# define ProgressBar |
|
|
|
|
self.pbar = Progressbar(self) |
|
|
|
|
|
|
|
|
|
# define listbox and scrollbar |
|
|
|
|
self.listbox = Listbox(self, selectmode=MULTIPLE) |
|
|
|
|
self.scrollbar = Scrollbar(self.listbox, orient=VERTICAL) |
|
|
|
|
|
|
|
|
|
# configure listbox and scrollbar |
|
|
|
|
self.listbox.config(yscrollcommand=self.scrollbar.set) |
|
|
|
|
self.scrollbar.config(command=self.listbox.yview) |
|
|
|
|
|
|
|
|
|
self.butcombine.grid(row=0, rowspan=2, columnspan=2, sticky=W + E + N + S, padx=5, pady=5) |
|
|
|
|
self.butdirchooser.grid(row=2, columnspan=2, padx=5, pady=5) |
|
|
|
|
self.butselall.grid(row=3, column=0) |
|
|
|
|
self.butselnone.grid(row=3, column=1) |
|
|
|
|
self.pbar.grid(row=4, columnspan=3, sticky=W + E + N + S, pady=5, padx=5) |
|
|
|
|
self.listbox.grid(column=2, row=0, rowspan=4, columnspan=2, sticky=W + E + N + S, pady=5, padx=5) |
|
|
|
|
# define progressframe |
|
|
|
|
self.pframe = Frame(self) |
|
|
|
|
|
|
|
|
|
# define Progresstext |
|
|
|
|
self.ptext = Label(self.pframe, text='', width=10, anchor=W) |
|
|
|
|
|
|
|
|
|
# define ProgressBar |
|
|
|
|
self.pbar = Progressbar(self.pframe) |
|
|
|
|
|
|
|
|
|
# layout buttons |
|
|
|
|
self.butcombine.grid(row=0, columnspan=2, sticky=W + E + N + S, padx=5, pady=5) |
|
|
|
|
self.butdirchooser.grid(row=1, columnspan=2, padx=5, pady=5) |
|
|
|
|
self.butselall.grid(row=2, column=0) |
|
|
|
|
self.butselnone.grid(row=2, column=1) |
|
|
|
|
|
|
|
|
|
# layout listbox and scrollbar |
|
|
|
|
self.listbox.columnconfigure(0, weight=1) |
|
|
|
|
self.listbox.rowconfigure(0, weight=1) |
|
|
|
|
self.listbox.grid(row=0, column=2, rowspan=3, columnspan=2, sticky=W + E + N + S, pady=5, padx=5) |
|
|
|
|
self.scrollbar.grid(column=1, sticky=N + S) |
|
|
|
|
|
|
|
|
|
# layout progressbar and text |
|
|
|
|
self.pframe.columnconfigure(1,weight=1) |
|
|
|
|
self.pframe.grid(row=3, column=0, columnspan=5, sticky=W+E+N+S, pady=5, padx=5) |
|
|
|
|
self.ptext.grid(row=0, column=0, sticky=W) |
|
|
|
|
self.pbar.grid(row=0, column=1, sticky=W + E + N + S) |
|
|
|
|
|
|
|
|
|
# defining options for opening a directory |
|
|
|
|
self.dir_opt = options = {} |
|
|
|
|
options['initialdir'] = 'C:\\' |
|
|
|
|
@ -49,7 +65,6 @@ class ProjectLiferFrame(Frame): |
|
|
|
|
self.rowconfigure(0, weight=5) |
|
|
|
|
self.rowconfigure(1, weight=1) |
|
|
|
|
self.rowconfigure(2, weight=1) |
|
|
|
|
self.rowconfigure(3, weight=1) |
|
|
|
|
|
|
|
|
|
def combine_pictures(self): |
|
|
|
|
|
|
|
|
|
@ -57,8 +72,10 @@ class ProjectLiferFrame(Frame): |
|
|
|
|
items = self.listbox.curselection() |
|
|
|
|
items = [self.files[int(item)] for item in items] |
|
|
|
|
|
|
|
|
|
self.pbar["value"] = 0 |
|
|
|
|
self.pbar["maximum"] = int(round(len(items) / 2)) |
|
|
|
|
max = int(round(len(items) / 2)) |
|
|
|
|
current = 0 |
|
|
|
|
self.pbar["value"] = current |
|
|
|
|
self.pbar["maximum"] = max |
|
|
|
|
root.update_idletasks() |
|
|
|
|
items = iter(items) |
|
|
|
|
|
|
|
|
|
@ -82,8 +99,12 @@ class ProjectLiferFrame(Frame): |
|
|
|
|
imgname2 = os.path.splitext(os.path.basename(i2))[0] |
|
|
|
|
new_im.save(self.folder + os.path.sep + '{}_and_{}.jpg'.format(imgname1, imgname2)) |
|
|
|
|
|
|
|
|
|
self.pbar["value"] += 1 |
|
|
|
|
current += 1 |
|
|
|
|
self.pbar["value"] = current |
|
|
|
|
self.ptext["text"] = '{}/{}'.format(current, max) |
|
|
|
|
root.update_idletasks() |
|
|
|
|
self.ptext["text"] = 'Done!' |
|
|
|
|
self.pbar["value"] = 0 |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
@ -127,6 +148,6 @@ if __name__ == '__main__': |
|
|
|
|
root.columnconfigure(0, weight=1) |
|
|
|
|
root.rowconfigure(0, weight=1) |
|
|
|
|
root.minsize(700, 500) |
|
|
|
|
root.title("ProjectLifer 1.0.1") |
|
|
|
|
root.title("ProjectLifer 1.0.2") |
|
|
|
|
ProjectLiferFrame(root).grid(row=0, column=0, sticky=(N, S, E, W)) |
|
|
|
|
root.mainloop() |
|
|
|
|
|