openfiledialog

Why tkinter ask open file has a low resolution?

Why tkinter ask open file has a low resolution? Question: In this picture you can see that the left dialog has a lower resolution then then right one. Why folders are different? I’m working with Python 3 and here’s my code from tkinter.filedialog import askopenfilename askopenfilename( initialdir = "/", title = "Select a File", filetypes …

Total answers: 3

Get file path from Tkinter filedialog not working

Get file path from Tkinter filedialog not working Question: Working on a project where I have a function that shows an open file dialog and prints out the path to the selected file. My code looks like this: import tkinter import customtkinter def openFile(self): filePath = tkinter.filedialog.askopenfile(initialdir=startingDir, title="Open File", filetypes=(("Open a .txt file", "*.txt"), ("All …

Total answers: 1

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

Quick and easy file dialog in Python?

Quick and easy file dialog in Python? Question: I have a simple script which parses a file and loads it’s contents to a database. I don’t need a UI, but right now I’m prompting the user for the file to parse using raw_input which is most unfriendly, especially because the user can’t copy/paste the path. …

Total answers: 8