Python Tkinter samples – Document Viewer

# Document Viewer
# Designed to view documents

from Tkinter import *
import tkFileDialog

master = Tk()
master.title("Document Viewer")

def open_command():
	file = tkFileDialog.askopenfile(mode='rb',title="Select desired file")
	if file != None:
		contents =
		contents_display = Text(width=900)
		contents_display.delete(1.0, END)
		contents_display.insert(END, contents)

open_document = Button(text="Open Document", command=open_command)


Only works in Python 2 at the moment, but will be ported over to Python 3.5 soon.

I hope you like my sample!

Epic Chas Gamer 😎


2 thoughts on “Python Tkinter samples – Document Viewer

Go on, you know you want to! Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: