diff --git a/main.py b/main.py index 0ce1a9d..6d2acb1 100644 --- a/main.py +++ b/main.py @@ -50,7 +50,7 @@ class MangaReader: self.panel.pack() def open_menu(self): - # file dialog. reset page counts, call display Maanga passing in starting values + # file dialog. reset page counts, call display Manga passing in starting values mangaFile = filedialog.askopenfilename() self.file = mangaFile self.page = 0 @@ -70,14 +70,15 @@ class MangaReader: data = zip.read(fl[pg]) im = Image.open(io.BytesIO(data)) + # I found the below code to maintain image ratios at https://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio wpercent = (basewidth / float(im.size[0])) hsize = int((float(im.size[1]) * float(wpercent))) im = im.resize((basewidth, hsize), Image.ANTIALIAS) - #convert to tkImage and update the on screen image. + # convert to tkImage and update the on screen image. self.img = ImageTk.PhotoImage(im) self.panel.config(image=self.img) - #finally update the current page count + # finally update the current page count self.pgcount.configure(text=str(pg+1) + " of " + str(self.total)) def nextPage(self, event): @@ -85,7 +86,7 @@ class MangaReader: if self.page < self.total: self.displayManga(self.file, self.page) else: - #reset self.page and doNothing + # reset self.page and doNothing self.page = self.page - 1 # self.doNothing() @@ -94,7 +95,7 @@ class MangaReader: if self.page >= 0: self.displayManga(self.file, self.page) else: - #reset self.page and doNothing + # reset self.page and doNothing self.page = self.page + 1 # self.doNothing() @@ -102,8 +103,7 @@ class MangaReader: print(self.page) print("FUCCK YOU") - -#initalize tk +# initalize tk root=Tk() app = MangaReader(root) root.mainloop()