Skip to main content

Document viewer widget for Tkinter (discontinued!)

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 discontinued. I will no longer be issuing updates or providing technical support.

I created tkDocViewer to fill a particular need using the tools I had available at the time. It did the job, but was never an elegant solution. Its design suffers from poor accessibility, high resource consumption, and limited support for advanced file-format features. For example, tkDocViewer displays PDF files simply by rendering each page as a bitmap image. This uses huge amounts of memory and processor time, and prevents tkDocViewer from supporting useful features like find-in-page, since it does not actually process textual content in PDF files as text.

Given its design limitations, and given that I no longer need it for my own projects, I have decided to discontinue development of tkDocViewer. The code will remain available on GitHub, since others may still find value in it. However, I will no longer be issuing updates or providing technical support.

If you are starting a new project where PDF support is important, I strongly encourage you to consider a more modern toolkit like GTK, Qt, or wxWidgets. These toolkits offer far more robust viewer widgets with greater accessibility, lower resource consumption, and more extensive file-format support than tkDocViewer can provide.

If you are still using tkDocViewer in an existing project, please note that users have reported PDF rendering problems with Ghostscript 9.5x releases. For more information, please see issue #1 on GitHub. Downgrading to Ghostscript 9.27 may help as a short-term workaround.

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 .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

tkDocViewer-2.0.1.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

tkDocViewer-2.0.1-py2.py3-none-any.whl (27.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tkDocViewer-2.0.1.tar.gz.

File metadata

  • Download URL: tkDocViewer-2.0.1.tar.gz
  • Upload date:
  • Size: 20.5 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.10

File hashes

Hashes for tkDocViewer-2.0.1.tar.gz
Algorithm Hash digest
SHA256 7b2dbeaf66e469c97858291b64a1ab5affd9a6cf48f485be1f46d607e2180c38
MD5 e375365583555f2fe5924544923489c5
BLAKE2b-256 cc23a7a76339b6fc0f1a2f4eff87d4c6877b1ff2889f4ef32b28a1df8fdebebe

See more details on using hashes here.

File details

Details for the file tkDocViewer-2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: tkDocViewer-2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.0 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.10

File hashes

Hashes for tkDocViewer-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2c7b9ffed0a375cd96c2363dc3844df1875f074eee1a07223fa24605e9628fd6
MD5 9f564ca52021faa59ec7e282b9912de2
BLAKE2b-256 f0e98f62a6813f2df937101b60fb6e2222219ffd56bb46853a8f742767c8d54c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page