# Copied from idlelib/textView
# - I copied it rather than imported since I didn't want
# to have a dependency on idlelib,
# and I can change what I may want.
# For example, I removed the transient and wait window things
# so a help window behaves more like a 'normal' window
"""Simple text browser
"""
from tkinter import *
import tkinter.messagebox
class TextViewer(Toplevel):
"""
simple text viewer dialog for idle
"""
def __init__(self, parent, title, fileName=None, data=None):
"""If data exists, load it into viewer, otherwise try to load file.
fileName - string, should be an absoulute filename
"""
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
self.geometry("=%dx%d+%d+%d" % (625, 500,
parent.winfo_rootx() + 10,
parent.winfo_rooty() + 10))
# elguavas - config placeholders til config stuff completed
self.bg = '#ffffff'
self.fg = '#000000'
self.CreateWidgets()
self.title(title)
# self.transient(parent)
# self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.Ok)
self.parent = parent
self.textView.focus_set()
# key bindings for this dialog
self.bind('