예제 #1
0
def HashMostCompactGUI():
    # -------  INPUT GUI portion  ------- #

    rc, source_filename = SG.GetFileBox(
        'Display A Hash Using PySimpleGUI',
        'Display a Hash code for file of your choice')

    # -------  OUTPUT GUI results portion  ------- #
    if rc == True:
        hash = compute_sha1_hash_for_file(source_filename)
        SG.MsgBox('Display Hash - Compact GUI',
                  'The SHA-1 Hash for the file\n', source_filename, hash)
    else:
        SG.MsgBox('Display Hash - Compact GUI', '* Cancelled *')
예제 #2
0
To improve paging performance, we are not directly creating pixmaps from
pages, but instead from the fitz.DisplayList of the page. A display list
will be stored in a list and looked up by page number. This way, zooming
pixmaps and page re-visits will re-use a once-created display list.

"""
import sys
import fitz
import PySimpleGUI as sg
from binascii import hexlify

sg.ChangeLookAndFeel('GreenTan')

if len(sys.argv) == 1:
    rc, fname = sg.GetFileBox('PDF Browser', 'PDF file to open', file_types=(("PDF Files", "*.pdf"),))
    if rc is False:
        sg.MsgBoxCancel('Cancelling')
        exit(0)
else:
    fname = sys.argv[1]

doc = fitz.open(fname)
page_count = len(doc)

# storage for page display lists
dlist_tab = [None] * page_count

title = "PyMuPDF display of '%s', pages: %i" % (fname, page_count)

예제 #3
0
"""
import sys
import fitz
import PySimpleGUI as sg
import tkinter as tk
from PIL import Image, ImageTk
import time

if len(sys.argv) == 1:
    rc, fname = sg.GetFileBox(
        'Document Browser',
        'Document file to open:',
        file_types=(
            ("PDF Files", "*.pdf"),
            ("XPS Files", "*.*xps"),
            ("Epub Files", "*.epub"),
            ("Fiction Books", "*.fb2"),
            ("Comic Books", "*.cbz"),
            ("HTML", "*.htm*"),
            # add more document types here
        ))
else:
    fname = sys.argv[1]

if not fname:
    sg.MsgBox("Cancelling:", "No filename supplied")
    raise SystemExit("Cancelled: no filename supplied")

doc = fitz.open(fname)
page_count = len(doc)