title: Open and Read text files in Tkinter Python
body: <p>I'm trying to create a notepad-type program in Tkinter and Can't work out how to display a file's contents to a Label...</p>
  
  <p>I have been able to display it's contents to the pyCharm shell but when I try to show in a label I get an error.</p>
  
  <pre><code>def openFile():
      fToOpen = filedialog.askopenfilename(filetypes=[("Text files","*.txt")])
      #print(fToOpen.read()) &lt;-- ##This works##
      fileToOpen = open(fToOpen, 'r')
      Label(root, fileToOpen.read()).pack() &lt;-- ##This doesn't##
      fToOpen.close()
  </code></pre>
  
  <p>The error I get is:</p>
  
  <blockquote>
  <pre><code>Traceback (most recent call last):
    File "C:\Users\Hello\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__
      return self.func(*args)
    File "C:/Users/Hello/Documents/html/Python/Prog.py", line 143, in openFile
      Label(root, fileToOpen.read()).pack(fill=Y)
    File "C:\Users\Hello\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 2760, in __init__
      Widget.__init__(self, master, 'label', cnf, kw)
    File "C:\Users\Hello\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 2289, in __init__
      classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)]
  AttributeError: 'str' object has no attribute 'items'
  </code></pre>
  </blockquote>
  
  <p>Can anyone help me?</p>