diff options
Diffstat (limited to 'Lib/idlelib/textView.py')
-rw-r--r-- | Lib/idlelib/textView.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py index 2ae9a9d..4257eea 100644 --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -12,7 +12,11 @@ class TextViewer(Toplevel): def __init__(self, parent, title, text, modal=True, _htest=False): """Show the given text in a scrollable window with a 'close' button - _htest - bool, change box location when running htest + If modal option set to False, user can interact with other windows, + otherwise they will be unable to interact with other windows until + the textview window is closed. + + _htest - bool; change box location when running htest. """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) @@ -68,8 +72,7 @@ def view_file(parent, title, filename, encoding=None, modal=True): try: with open(filename, 'r', encoding=encoding) as file: contents = file.read() - except OSError: - import tkinter.messagebox as tkMessageBox + except IOError: tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) @@ -77,5 +80,7 @@ def view_file(parent, title, filename, encoding=None, modal=True): return view_text(parent, title, contents, modal) if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_textview', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(TextViewer) |