Skip to main content

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

Release files for tkDocViewer 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tkDocViewer 2.0.2
File Size Uploaded
tkDocViewer-2.0.2.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tkDocViewer 2.0.2
File Interpreter ABI Platform
tkDocViewer-2.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 46.9 kB

Release files / tkDocViewer-2.0.2.tar.gz

Download URL tkDocViewer-2.0.2.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
968380439a8eeb03a11452c5c14dc2b778ac857ffb0a4d7c6184688a9b753a64
BLAKE2b-256 checksum
How to use checksums
71ec73132eaa6aa7ef97541d10e52a5fd30b8999f907b2993921972ab9fe0dc9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / tkDocViewer-2.0.2-py2.py3-none-any.whl

Download URL tkDocViewer-2.0.2-py2.py3-none-any.whl
Size 26.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a513763ff4abcac73061e908dcadcb68ba1a6ffc3fbe7b145884b526aead34df
BLAKE2b-256 checksum
How to use checksums
0a688ca8fecc989f4b9c0b4bbd36b5eae893eb590ed36de5b0b973853e278dc8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page