Files
mangaReader/main.py

46 lines
985 B
Python

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()