Option "mustexist=False" in askdirectory (tkinter)

Viewed 475

I'm trying to display a folder selection dialog with tkinter in Python, using tkinter.filedialog.askdirectory.

The docs say there is an option called:

mustexist - determines if selection must be an existing directory.

I'd suppose it means by setting mustexist = False, I can enter any arbitrary non-existent path into the bar at the top or the bottom and when hitting "Select folder", it should just return this path without asserting that it exists. Doing so however, an error saying "path does not exist" still appears, preventing dialog return.

Code to reproduce:

import tkinter as tk
from tkinter.filedialog import askdirectory

root = tk.Tk()
root.withdraw()
print(askdirectory(mustexist=False))

(tested on Python3.6 + 3.7 on Windows)

Do I missunderstand something here? Or does it indeed just not work as it should?

0 Answers
Related