Worked on frames

This commit is contained in:
2020-09-03 10:19:15 -04:00
parent d749cb2e96
commit 39341595c6
2 changed files with 34 additions and 5 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,7 @@
__pycache__/* __pycache__/*
.idea .idea
venv/* venv/*
build/*
dist/*
notes.txt
main.spec

35
main.py
View File

@@ -27,27 +27,51 @@ class MangaReader:
self.menu.add_cascade(label="File", menu=item) self.menu.add_cascade(label="File", menu=item)
root.config(menu=self.menu) root.config(menu=self.menu)
# Frames
self.buttonFrame = Frame(master) self.buttonFrame = Frame(master)
self.mangaFrame = Frame(master, bg="green")
self.titleFrame = Frame(master)
# forward/back buttons # forward/back buttons
self.nextPg = Button(self.buttonFrame, text='>') self.nextPg = Button(self.buttonFrame, text='>')
self.nextPg.bind('<Button-1>', self.nextPage) self.nextPg.bind('<Button-1>', self.nextPage)
self.nextPg.grid(row=0, column=2) self.nextPg.grid(row=0, column=2)
self.buttonFrame.pack(side=BOTTOM) self.buttonFrame.grid_rowconfigure(0, weight=1)
self.buttonFrame.grid_columnconfigure(2,weight=1)
self.buttonFrame.grid(row=2, column=0, columnspan=2)
self.master.grid_rowconfigure(2, weight=1)
self.master.grid_columnconfigure(0,weight=1)
# self.buttonFrame.pack(side=BOTTOM)
self.backPg = Button(self.buttonFrame, text='<') self.backPg = Button(self.buttonFrame, text='<')
self.backPg.bind('<Button-1>', self.backPage) self.backPg.bind('<Button-1>', self.backPage)
self.backPg.grid(row=0, column=0) self.backPg.grid(row=0, column=0)
self.buttonFrame.grid_rowconfigure(0, weight=1)
self.buttonFrame.grid_columnconfigure(0,weight=1)
# page counter # page counter
self.pgcount = Label(self.buttonFrame, text= str(self.page) + " of " + str(self.total)) self.pgcount = Label(self.buttonFrame, text= str(self.page) + " of " + str(self.total))
self.pgcount.grid(row=1, columns=1, columnspan=2) self.pgcount.grid(row=1, columns=1, columnspan=2)
self.buttonFrame.grid_rowconfigure(1, weight=1)
self.buttonFrame.grid_columnconfigure(1,weight=1)
self.mangaTitle = Label(self.buttonFrame, text=self.file) # title frame
self.mangaTitle.grid(row=0, column=1)
self.titleFrame.grid(row=0, column=0, sticky="EW")
self.master.grid_rowconfigure(0, weight=1)
self.master.grid_columnconfigure(0,weight=1)
self.mangaTitle = Label(self.titleFrame, text=self.file)
self.mangaTitle.grid(row=0, sticky="EW")
self.titleFrame.grid_rowconfigure(0,weight=1)
self.titleFrame.grid_columnconfigure(0,weight=1)
# display image # display image
self.panel = Label(self.master, image=self.img) self.mangaFrame.grid(row=1, column=0, sticky="NESW")
self.panel.pack() self.master.grid_rowconfigure(1, weight=1)
self.master.grid_columnconfigure(0,weight=1)
self.panel = Label(self.mangaFrame, image=self.img)
self.panel.grid(row=0, column=0, sticky="NESW")
self.panel.grid_rowconfigure(0, weight=1)
self.panel.grid_columnconfigure(0, weight=1)
def open_menu(self): def open_menu(self):
# file dialog. reset page counts, call display Manga passing in starting values # file dialog. reset page counts, call display Manga passing in starting values
@@ -61,6 +85,7 @@ class MangaReader:
def displayManga(self, file, pg): def displayManga(self, file, pg):
basewidth = 500 basewidth = 500
basewidth = self.mangaFrame.winfo_width()
with zf(file, 'r') as zip: with zf(file, 'r') as zip:
# grab all the manga pages from the cbz file and sort them to put them in the correct order # grab all the manga pages from the cbz file and sort them to put them in the correct order
fl = zip.namelist() fl = zip.namelist()