def seam(self): global im amt = (abs(int(self.entry1.get())) + 1) loops = abs(int(self.entry2.get())) self.button.destroy() self.label1.pack_forget() self.entry1.pack_forget() self.label2.pack_forget() self.entry2.pack_forget() self.loading = Tkinter.Label(self.top, text="Loading...").pack(padx = 10, pady = 5) progressbar = self.progressbar = ttk.Progressbar(master = self.top, orient='horizontal', length=200, mode='determinate') progressbar.pack(padx = 10, pady = 5) cancelbutton = self.cancelbutton = Tkinter.Button(self.top, text="Cancel", command=self.cancel) cancelbutton.pack(pady = 5) root.update_idletasks() for x in xrange(loops): im2 = seamer(im, amt, 1) self.progressbar.step(100/loops) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image = tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('seamer') root.update() if self.top == None: return self.top.destroy()
def randomize(): global im listoper = [ shifter, degrader, tear, blur, pixelate, disperse, graindrip, seamer ] randint1 = random.randint(0, 30) randint2 = random.randint(0, 2000) randint3 = random.randint(0, 2000) randint4 = random.randint(1, 3) randint5 = random.randint(1, 300) cmd = random.choice(listoper) print cmd if cmd == pixelate: im2 = pixelate(im, randint1) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image=tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('pixelate') elif cmd == disperse: im2 = disperse(im, randint1, randint2, randint3) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image=tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('disperse') elif cmd == graindrip: Gain = float(random.random()) Height = int(randint2) im2 = graindrip(im, Gain, Height) tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image=tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('ndrip') elif cmd == seamer: im2 = seamer(im, randint5, randint4) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image=tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('seamer') else: cmd()
def randomize(): global im listoper = [shifter,degrader,tear,blur, pixelate, disperse, graindrip, seamer] randint1 = random.randint(0, 30) randint2 = random.randint(0,2000) randint3 = random.randint(0,2000) randint4 = random.randint(1,3) randint5 = random.randint(1, 300) cmd = random.choice(listoper) print cmd if cmd == pixelate: im2 = pixelate(im, randint1) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image = tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('pixelate') elif cmd == disperse: im2 = disperse(im, randint1, randint2, randint3) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image = tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('disperse') elif cmd == graindrip: Gain = float(random.random()) Height = int(randint2) im2 = graindrip(im, Gain, Height) tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image = tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('ndrip') elif cmd == seamer: im2 = seamer(im,randint5, randint4) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image = tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('seamer') else: cmd()
def seam(self): global im amt = (abs(int(self.entry1.get())) + 1) loops = abs(int(self.entry2.get())) self.button.destroy() self.label1.pack_forget() self.entry1.pack_forget() self.label2.pack_forget() self.entry2.pack_forget() self.loading = Tkinter.Label(self.top, text="Loading...").pack(padx=10, pady=5) progressbar = self.progressbar = ttk.Progressbar(master=self.top, orient='horizontal', length=200, mode='determinate') progressbar.pack(padx=10, pady=5) cancelbutton = self.cancelbutton = Tkinter.Button(self.top, text="Cancel", command=self.cancel) cancelbutton.pack(pady=5) root.update_idletasks() for x in xrange(loops): im2 = seamer(im, amt, 1) self.progressbar.step(100 / loops) im = im2 tkimage2 = ImageTk.PhotoImage(im2) canvas.configure(image=tkimage2) canvas.image = tkimage2 imagecopy = im2.copy() imagelist.append(imagecopy) statelist.append(random.getstate()) operationlist.append('seamer') root.update() if self.top == None: return self.top.destroy()