view模块是用于管理执行绘制操作的函数。
模块名
定义了以下函数。
| 函数 | 说明 | 操作对象 |
|---|---|---|
| get_file_path_with_dialog | 获取文件路径 | - |
| show_dialog | 显示对话框 | - |
使用对话框获取所选文件的路径。
在输入参数mode中指定要显示的对话框类型。mode(模式)分別为"open"和"save"两种。
在输入参数suffix中指定文件扩展名。可以使用以下三种方式指定。
在输入参数 folder_path 中指定在对话框中打开的预设文件夹的路径。省略该参数时,将打开Document作为预设文件夹。
从 Ver.3.46.04 开始,添加了本函数。
| 名称 | 值 |
|---|---|
| mode | 对话框的类型 |
| suffix | 对话框选中的文件扩展名 |
| folder_path | 在对话框中打开的预设文件夹 |
| 名称 | 值 |
|---|---|
| result [ "succeed" ] | 成功时为True,失败时为False |
| result [ "data" ] | 选中文件路径的字符串 |
显示对话框。
对话框中备有能够复制到剪贴板的文本区域以及最多3个按钮。
在输入参数 message 中指定要显示的语句。换行编写为\n。
在输入参数 button_name_list 中,通过列表指定按钮的文本。最多3个按钮。
button_name_list 中指定 ["是", "否", "取消"] 。button_name_list 中指定 ["OK"] 。返回值是关联数组。
关联数组包含 button_index 和 button_name 两个Key。
button_index Key的值是按下的按钮的索引。(索引是从0开始。)
button_name Key的值是按下的按钮的文本。
通过按下x按钮等操作关闭对话框后,索引和名称分别是-1和空字符串。
从 Ver.3.45.00 开始,添加了本函数。
| 名称 | 值 |
|---|---|
| message | 要显示的文本 |
| button_name_list | 按钮名的列表(最多三个) |
| 名称 | 值 |
|---|---|
| result [ "succeed" ] | 成功时为True,失败时为False |
| result [ "data" ] | 具有 button_index, button_name Key的关联数组 |
| result [ "data" ][ "button_index" ] | 按下的按钮的索引(从0开始) 未按下时为 -1 |
| result [ "data" ][ "button_name" ] | 按下的按钮的文本 |