Silence unclosed open file ResourceWarning.

This commit is contained in:
Terry Jan Reedy 2013-05-13 16:07:44 -04:00
parent 01180d4679
commit bf4cba7e8b
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@ if __name__ == '__main__':
root=Tk()
root.title('textView test')
filename = './textView.py'
text = open(filename, 'r').read()
with open(filename, 'r') as f:
text = f.read()
btn1 = Button(root, text='view_text',
command=lambda:view_text(root, 'view_text', text))
btn1.pack(side=LEFT)