2

I am using tkinter.filedialog.askopenfilename in Python to select a file. How do I change the font size for the file list displayed? I have found answers on StackOverflow on how to change the font of some items on the display (for example here), but do not know the name of the ttk widget that is used for the file list.

3
  • I don't think askopenfilename gives that kind of control. The answer to that linked question which attempts to use a ttk.Style wouldn't work because filedialogs have nothing to do with ttk widgets (note how the Style created in never used after it's configured). You should be able to do what you want by creating your own dialog widget that internally used a tkinter.Listbox which does support a font option. Commented Oct 18, 2019 at 5:14
  • You might find the answers to the question Correct way to implement a custom popup tkinter dialog box useful in creating your own dialog class. Commented Oct 18, 2019 at 5:23
  • I've run into the same issue. Modifying TkDefaultFont changes the font of the buttons and labels around the file list, but does not affect the file list itself. On my high density display, the file list uses a tiny font, I need to stick my nose in the monitor to read it. Commented Nov 8, 2021 at 23:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.