#!/usr/bin/env python3 # -*-coding:utf-8 -* import tkinter as tk from pdfembannersrc import choice import logging import argparse #TODO : # * Remove Forms parser = argparse.ArgumentParser(description=""" PDF Embanner Program to manipulate PDFs based on PyPDF2 python library use pdfembanner to launch GUI """, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('--verbose', '-v', action='count') args = parser.parse_args() # Logger logger = logging.getLogger() logger.setLevel(logging.DEBUG) console_handler = logging.StreamHandler() if(args.verbose is not None): if(args.verbose==1): console_handler.setLevel(logging.WARN) elif(args.verbose==2): console_handler.setLevel(logging.INFO) elif(args.verbose>=3): console_handler.setLevel(logging.DEBUG) else: console_handler.setLevel(logging.ERROR) formatter = logging.Formatter('%(levelname)s :: %(message)s') console_handler.setFormatter(formatter) logger.addHandler(console_handler) if(args.verbose is not None and args.verbose>=2): logger.info("Logger level set to {}".format("INFO" if args.verbose==2 else "DEBUG")) logger.debug("Launching app") # Main window fenetre = tk.Tk() fenetre.geometry("+400+200") fenetre.title("PDF Embanner") interface = choice.Choice(fenetre) fenetre.resizable(0,0) fenetre.bind("", interface.close) fenetre.bind("1", interface.do1) fenetre.bind("2", interface.do2) fenetre.bind("3", interface.do3) fenetre.bind("4", interface.do4) fenetre.bind("5", interface.do5) fenetre.bind("6", interface.do6) fenetre.bind("7", interface.do7) logger.debug("App launched") fenetre.mainloop() logger.debug("App closed")