DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

add_file_dialog not showing files in directory

Open asluborski opened this issue 3 years ago • 2 comments

Version of Dear PyGui

Version: 1.9.0 Operating System: Windows 11

My Issue/Question

When using add_file_dialog with file extensions set to .*, no files show on my system. Not sure if I am calling something wrong.

To Reproduce

Steps to reproduce the behavior: See code

Expected behavior

Supposed to show all files

Screenshots/Video

bug

Standalone, minimal, complete and verifiable example

def browseDirectoryImages():
    with dpg.add_file_dialog(directory_selector=False, show=True, callback=callback, tag="file_dialog_id",cancel_callback=cancel_callback, width=700 ,height=400):
        dpg.add_file_extension(".*")
        dpg.add_file_extension("", color=(150, 255, 150, 255))
        dpg.add_file_extension("Source files (*.cpp *.h *.hpp){.cpp,.h,.hpp}", color=(0, 255, 255, 255))
        dpg.add_file_extension(".h", color=(255, 0, 255, 255), custom_text="[header]")
        dpg.add_file_extension(".py", color=(0, 255, 0, 255), custom_text="[Python]")
import dearpygui.dearpygui as dpg
from utils.utilities import browseDirectoryImages,getMonitorDimensions



dpg.create_context()
monitor_width,monitor_height = getMonitorDimensions()

with dpg.window(tag="Primary Window"):
    with dpg.child_window(width=200):
        dpg.add_button(label="Open Folder", callback=lambda:browseDirectoryImages())
    
viewport = dpg.create_viewport(title='ImageX', width = monitor_width, height = monitor_height)

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("Primary Window", True)
dpg.maximize_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

am getting this error in terminal when opening the file dialog through button

with dpg.add_file_dialog(directory_selector=False, show=True, callback=callback, tag="file_dialog_id",cancel_callback=cancel_callback, width=700 ,height=400):
TypeError: 'str' object does not support the context manager protocol

asluborski avatar Apr 16 '23 08:04 asluborski

Change dpg.add_file_dialog to with dpg.file_dialog(directory_selector=False, show=True, callback=callback, tag="file_dialog_id",cancel_callback=cancel_callback) problem solved.

utmcontent avatar Apr 17 '23 17:04 utmcontent

@asluborski do you need more help? Has your problem been solved? If so, would you please close this ticket?

v-ein avatar Dec 01 '23 20:12 v-ein