Document viewer widget for Tkinter
Project description
tkDocViewer is an inefficient, yet practical, Tkinter widget for displaying file previews.
It supports a variety of document and image formats; see below for the complete list. Support for new formats can be added through a modular backend system.
Both Python 2 and 3 are supported, on Windows and Unix platforms.
Development Status
tkDocViewer is deprecated. If PDF support is important to your project, please use a better toolkit than Tk.
I created tkDocViewer to fill a particular need using the tools I had available at the time. It does the job, but there are better alternatives offering greater accessibility, lower resource consumption, and broader file format support. If your project is open-source I recommend you check out Poppler, which is actively maintained and provides bindings for several popular languages and toolkits.
Usage
tkDocViewer consists of a single module, tkdocviewer
(note the module name is lowercase), which exports a single class, DocViewer
.
A brief example program:
#!/usr/bin/env python3
from tkinter import *
from tkdocviewer import *
# Create a root window
root = Tk()
# Create a DocViewer widget
v = DocViewer(root)
v.pack(side="top", expand=1, fill="both")
# Display some document
v.display_file("example.pdf")
# Start Tk's event loop
root.mainloop()
For detailed documentation, try python3 -m pydoc tkdocviewer
.
Supported Formats
Note: Most file formats require third-party modules or external applications to be present at runtime. tkDocViewer will still work without them, but file format support will be limited by what's available on your system.
Document Formats
Format | Extensions | Requirements | Notes |
---|---|---|---|
.pdf |
Ghostscript | ||
Plain text | .txt |
none | |
Postscript | .ps |
Ghostscript | |
XPS | .xps |
Ghostscript, GhostXPS | OpenXPS has not been tested. |
Image Formats
Format | Extensions | Requirements | Notes |
---|---|---|---|
Bitmap image | .bmp , .pcx |
Pillow | |
GIF | .gif |
Pillow | Animations are displayed as individual frames. |
JPEG | .jpe , .jpg , .jpeg |
Pillow | |
PNG | .png |
Pillow | |
Netpbm | .pbm , .pgm , .pnm , .ppm |
Pillow | |
Targa | .tga |
Pillow | |
TIFF | .tif , .tiff |
Pillow | Supports multi-page documents. |
Windows icon | .ico |
Pillow | |
X bitmap | .xbm |
Pillow |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tkDocViewer-2.0.2.tar.gz
.
File metadata
- Download URL: tkDocViewer-2.0.2.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 968380439a8eeb03a11452c5c14dc2b778ac857ffb0a4d7c6184688a9b753a64 |
|
MD5 | a678b4da4e65d2b6b66513756181df6f |
|
BLAKE2b-256 | 71ec73132eaa6aa7ef97541d10e52a5fd30b8999f907b2993921972ab9fe0dc9 |
File details
Details for the file tkDocViewer-2.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: tkDocViewer-2.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a513763ff4abcac73061e908dcadcb68ba1a6ffc3fbe7b145884b526aead34df |
|
MD5 | b2d47c9b3f24bd20b2b03da1aa46a3b3 |
|
BLAKE2b-256 | 0a688ca8fecc989f4b9c0b4bbd36b5eae893eb590ed36de5b0b973853e278dc8 |