Comments (2)
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.
from dearpygui.
Hi Vladimir,
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).
from dearpygui.
Related Issues (20)
- Resizable table rows HOT 1
- dpg.get_mouse_pos() returned unintended position HOT 4
- Ability to customize styles for Ctrl-Tab panel and other built-in ImGui windows
- Local wheel guide outdated
- output_frame_buffer missing support in macosx aarch64
- Show/hide doesn't work on the legend in dpg.subplots
- dpg.hide() on plot_axis also hides the legend
- Tabs bar position not working. HOT 1
- Question: Adding DearPyGui to existing imgui C++ application with an embedded Python interpreter
- Window position is invalidated when setting a label to it HOT 1
- STB to support UTF-8, it needs to be built with the `STBI_WINDOWS_UTF8` define HOT 1
- Callbacks Not Triggering for Node Manipulations in Node Editor
- Dynamic display GUI HOT 13
- GUI launches as a window in window, when gui window is closed you're left with black main window HOT 2
- Install Dearpygui to Compute Module 4
- Get viewport maximization/mlnimization state
- Unable to customize AxisScale
- Support for font awesome and similar unicode based icon library HOT 1
- Viewport client size is reported incorrectly at startup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dearpygui.