hoffstadt / hoffstadt/DearPyGui
Directory Selector duplicate folder name at the end of the string in "selections" dict
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.8.0
Operating System: Windows 11 (Build 22621.674)
## My Issue/Question
When I used Directory Selector component its duplicate name of the folder at the end of string in "selections" dict. So, instead of "C:\test" folder it always will be "C:\test\test".
## To Reproduce
Use `dpg.add_file_dialog` with `directory_selector=True` parameter.
## Expected behavior
Folder path without duplication. If I choose "C:\test" I expect same path.
## Screenshots/Video

## Standalone, minimal, complete and verifiable example
```python
import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.value_registry():
dpg.add_string_value(default_value="", tag="dir_path")
def directory_picker_open(sender, data):
selections = data["selections"]
if len(selections) > 0:
dir_path = selections[next(iter(selections))]
print(str(dir_path))
dpg.set_value("dir_path", dir_path)
else:
msg = "Folder not selected"
print(msg)
dpg.set_value("dir_path", msg)
def directory_picker_close(sender, data):
print("Directory not selected")
dpg.add_file_dialog(
directory_selector=True,
file_count=1,
show=False,
callback=directory_picker_open,
cancel_callback=directory_picker_close,
tag="dialog_dir",
)
with dpg.window(tag="Main"):
with dpg.child_window(autosize_x=True):
with dpg.group():
dpg.add_button(
label="Select directory",
callback=lambda: dpg.show_item("dialog_dir"),
)
with dpg.group(horizontal=True, horizontal_spacing=5):
dpg.add_text("Directory Path: ")
dpg.add_text(
source="dir_path",
color=[0, 255, 0],
)
dpg.create_viewport(title="Test Directory Selector")
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("Main", True)
dpg.start_dearpygui()
dpg.destroy_context()
```
Contributor guide
Assessment
This issue has not been assessed yet.