-
Notifications
You must be signed in to change notification settings - Fork 18
pyui.select_folder
Daniel Flassig edited this page Jul 23, 2026
·
3 revisions
Displays the system folder-selection dialog and returns a path handle to the folder the user picks.
pyui.select_folder(access, title, options)| Parameter | Type | Description |
|---|---|---|
access |
string |
The access to request for the selected folder. One of "read" (read only) or "full" (create, modify and delete files). |
title |
string (optional)
|
The text shown in the title bar of the dialog. |
options |
table (optional)
|
Additional options, see below. |
| Option | Type | Description |
|---|---|---|
scope |
string |
How much of the folder is made accessible. One of "folder" (the folder and its direct files, the default) or "recursive" (the folder and its complete sub-tree). |
start_at |
path handle |
A path handle that refers to a folder. It is used to pre-select a starting folder in the dialog. |
| Type | Description |
|---|---|
path handle |
A path handle to the selected folder, carrying the requested access level. Returns nil if the user cancels the dialog. |
When access is "full", the user is asked to explicitly confirm write access to the chosen folder. If the confirmation is declined, the function returns nil as though the dialog had been cancelled.
The resulting handle carries the access level that matches scope: "folder" yields a directory handle, "recursive" yields a recursive handle.
local folder = pyui.select_folder("full", "Choose an export folder", {scope = "recursive"})
if folder then
local target = folder:append_path("report.txt")
pyio.write_lines(target, {"# Export report", "Parts exported: 3"})
else
pyui.alert("No folder was selected.")
endMinimum PYTHA Version: V26
pyui, Path Handles, pyui.select_open_file, pyui.select_save_file, pyio.write_lines, pyio.append_path, pyio.list_folder