forked from totallynotdrait/file_dialog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
22 lines (16 loc) · 728 Bytes
/
example.py
File metadata and controls
22 lines (16 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import dearpygui.dearpygui as dpg
from fdialog import FileDialog
dpg.create_context()
def pr(selected_files): # file_dialog calls the callback with as argument a list containing the selected files
dpg.delete_item("txt_child", children_only=True)
for file in selected_files:
dpg.add_text(file, parent="txt_child")
fd = FileDialog(callback=pr, default_path="..")
with dpg.window(label="hi", height=480, width=600):
dpg.add_button(label="Show file dialog", callback=fd.show_file_dialog)
dpg.add_child_window(width=-1, height=-1, tag="txt_child")
dpg.create_viewport(title='file_dialog example')
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()