filedialog

How is it an unmatched ")"?

How is it an unmatched ")"? Question: Consider: from tkinter import * from tkinter import filedialog def openFile(): filepath = filedialog.askopenfile() file = open(filepath), ‘r’) print(file.read()) file.close() window = Tk() button = Button(text="Open",command=openFile) button.pack() window.mainloop() Error: C:UsersHpPycharmProjectspythonProjectvenvScriptspython.exe "C:UsersHpPycharmProjectspythonProjectopen a file.py" File "C:UsersHpPycharmProjectspythonProjectopen a file.py", line 7 file = open(filepath), ‘r’) ^ SyntaxError: unmatched ‘)’ Process …

Total answers: 2

filedialog, tkinter and opening files

filedialog, tkinter and opening files Question: I’m working for the first time on coding a Browse button for a program in Python3. I’ve been searching the internet and this site, and even python standard library. I have found sample code and very superficial explanations of things, but I haven’t been able to find anything that …

Total answers: 4