Inital commit. Sorta kinda has a menu bar with option to open a cbz file. It then opens the first image in the default image viewer. Working on getting 'next' button added.

This commit is contained in:
Dan
2020-08-22 21:51:43 -04:00
commit 41458e3285
5 changed files with 212 additions and 0 deletions

45
main.py Normal file
View File

@@ -0,0 +1,45 @@
from tkinter import *
from tkinter import filedialog
from zipfile import ZipFile as zf
from PIL import Image
import time
import io
page = 0
file = ''
def open_menu():
mangaFile = filedialog.askopenfilename()
file = mangaFile
displayManga(file,1)
def displayManga(file,pg):
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
fl = zip.namelist()
fl.sort()
data = zip.read(fl[pg-1])
im = Image.open(io.BytesIO(data))
im.show()
page = pg
#initalize tk
root=Tk()
root.title("Manga Reader")
#tk window size and allow resize
root.geometry("500x300")
root.resizable(width=True, height=True)
#Menu Bar
menu = Menu(root)
item = Menu(menu)
item.add_command(label="Open", command=open_menu)
item.add_separator()
item.add_command(label="Exit", command=root.quit)
menu.add_cascade(label="File", menu=item)
root.config(menu=menu)
root.mainloop()