From b5f3fe3b2577d68d2a8b34c7188ac53919ce2a3d Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 7 May 2021 11:39:01 -0400 Subject: [PATCH] moved next/back buttons down a row. Displaying just filename instead of entire path. Added keybindings for next/back/quit. --- main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index b29e477..1fea466 100644 --- a/main.py +++ b/main.py @@ -34,17 +34,17 @@ class MangaReader: # forward/back buttons self.nextPg = Button(self.buttonFrame, text='>') self.nextPg.bind('', self.nextPage) - self.nextPg.grid(row=0, column=2) + self.nextPg.grid(row=1, column=2) self.buttonFrame.pack(side=BOTTOM) self.backPg = Button(self.buttonFrame, text='<') self.backPg.bind('', self.backPage) - self.backPg.grid(row=0, column=0) + self.backPg.grid(row=1, column=0) # page counter self.pgcount = Label(self.buttonFrame, text= str(self.page) + " of " + str(self.total)) self.pgcount.grid(row=1, columns=1, columnspan=2) - self.mangaTitle = Label(self.buttonFrame, text=self.file) + self.mangaTitle = Label(self.buttonFrame, text=os.path.basename(self.file)) self.mangaTitle.grid(row=0, column=1) # display image @@ -52,6 +52,11 @@ class MangaReader: self.panel.pack() self.panel.bind('', self.redraw) + # key bindings + self.master.bind('', self.nextPage) + self.master.bind('', self.backPage) + self.master.bind('q', quit) + def open_menu(self): # file dialog. reset page counts, call display Maanga passing in starting values if self.dir == 'None': @@ -62,7 +67,7 @@ class MangaReader: if self.file != '': self.page = 0 self.total = 0 - self.mangaTitle.configure(text=self.file) + self.mangaTitle.configure(text=os.path.basename(self.file)) self.dir = os.path.dirname(self.file) self.displayManga(self.file, 0) @@ -96,6 +101,7 @@ class MangaReader: #finally update the current page count self.pgcount.configure(text=str(pg+1) + " of " + str(self.total)) + self.panel.focus_set() self.master.config(width=wsize) def nextPage(self, event):