import tkinter.filedialog path = tkinter.filedialog.askopenfilename() if path: with open(path, 'r') as f: print(f.read()) else: print("No good")