You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing the same error as in discussion #1609 using the file_dialog. Using the code below, the error occurs on subsequent launches of the file dialog (not on the first launch). The error message made me suspect the issue related to using a tag for the file_dialog. Indeed, when remove the tag from the code, the error is avoided. Maybe using a tag for a dialog is not recommended, but I got in the habit of tagging all UI elements. In any case, hope this helps narrow down the bug.
To Reproduce
Steps to reproduce the behavior:
Launch the MRE code included below
Click on the 'Load' button.
Select a file or cancel, doesn't matter. Just get the dialog to go away.
Click the 'Load' button a 2nd time.
Kablamo! Error occurs
Expected behavior
I expect no kablamos using the file dialog.
Standalone, minimal, complete and verifiable example
Traceback (most recent call last):
File "...venv/lib/python3.10/site-packages/dearpygui/dearpygui.py", line 1816, in file_dialog
widget = internal_dpg.add_file_dialog(label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, width=width, height=height, callback=callback, show=show, default_path=default_path, default_filename=default_filename, file_count=file_count, modal=modal, directory_selector=directory_selector, min_size=min_size, max_size=max_size, cancel_callback=cancel_callback, **kwargs)
SystemError: <built-in function add_file_dialog> returned a result with an exception set
During handling of the above exception, another exception occurred:
Exception: Error: [1009] Message: No container to pop.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "...debug_file_dialog_crash.py", line 5, in choose_file
with dpg.file_dialog(
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "...venv/lib/python3.10/site-packages/dearpygui/dearpygui.py", line 1820, in file_dialog
internal_dpg.pop_container_stack()
SystemError: <built-in function pop_container_stack> returned a result with an exception set
The text was updated successfully, but these errors were encountered:
The file dialog behaves much like a regular dpg.window (it's a window, after all). In particular, when you click OK or Cancel, it doesn't get deleted - instead, it gets hidden. This way you can query some properties from it or reuse the dialog widget later.
You can see it by adding the following line to your example:
dpg.show_item_registry()
Look at the File Dialogs section in the Item Registry.
You can even bring it back by clicking the Show button in the Item Registry.
So when you click the Load button in your examlpe second time, there's already a file dialog in the GUI with the tag "file_selector". DPG actually tells you that straight, before the first SystemError message:
Exception:
Error: [1000]
Command: add alias
Item: 0
Label: Not found
Item Type: Unknown
Message: Alias already exists
The same would happen if you were creating a dpg.window that way. When the window is closed, it remains hidden until you delete it explicitly with dpg.delete_item().
It is perfectly normal to use a tag with dpg.file_dialog, as long as your code manages the item lifetime properly:
Either delete the file dialog after OK/Cancel and re-create each time,
or create it once (probably before first use) and then use dpg.show("file_selector") instead of creating the file dialog again.
Thanks for the explanation. That logic and message is what made me try removing the tag to see if it fixes the problem. I get that is how it works, but the documentation doesn't mention this and the example there uses a tag without managing the dialog.
In any other GUI library I've used, I don't recall dialog windows having to managed this way. Just my opinion, but this feels like an implementation detail that should be handled in the library itself. It is nice that it would be an option to keep an instance of the dialog and show / hide it manually, but again, maybe something that should be handled automatically by default.
Also, I found in debug mode it crashes the whole program. In normal running mode, it emits the error I posted but the app remains open and an additional file dialog is opened (if the first one wasn't closed).
DearPyGUI version: 1.11.1
Python version: 3.10
Operating System: Ubuntu 22.04
I'm seeing the same error as in discussion #1609 using the
file_dialog
. Using the code below, the error occurs on subsequent launches of the file dialog (not on the first launch). The error message made me suspect the issue related to using a tag for thefile_dialog
. Indeed, when remove the tag from the code, the error is avoided. Maybe using a tag for a dialog is not recommended, but I got in the habit of tagging all UI elements. In any case, hope this helps narrow down the bug.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect no kablamos using the file dialog.
Standalone, minimal, complete and verifiable example
Traceback
The text was updated successfully, but these errors were encountered: