New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get size of node editor nodes with e.g. dpg.get_item_width #1239
Comments
I can confirm this is happening to me also. It happens with basic non-node elements as well, like windows. I could not get a correct size with Version 0.8.64 with Python 3.9 on Arch Linux. |
This is an issue with terminology on our part. Width/height is the width and height you set. What you are looking for is This may seem odd but you have to remember that the width/height can also be set as pixels from the right/bottom. For example, if you set the width to -50, the item will stretch to be 50 pixels from the right of its container. Aside from internally needing to keep up with "-50", users may also want to retrieve that value. So the ACTUAL size of an item is the rect_size. There is some issues still with this for 0.8 but we are addressing them for 1.0 for Oct 12. |
We will explain this further in the docs! |
As mentioned in my comment, |
This should work in 1.0.0rc2? |
Ok, my bad. Thanks. |
Would I need to clone and build to test out 1.0rc2 or is there a way to get it from PyPI? |
@christuart I owe you several responses this week. I haven't been ignoring you, just swapped with the new 1.0 release coming today. Check here: https://github.com/hoffstadt/DearPyGui/discussions/1283 Its now 1.0.0rc5 |
I have not felt ignored 🙂 thanks for the link, I hope I can try it out during this week |
This seems to still be an issue in both versions Running the code posted above by @christuart gives me
|
Fixed in release later today! |
works like a charm, thank you @hoffstadt ! I'm impressed by your reaction time :) |
Doesent seem to work for me. Edit: |
Same problem here. When I want to get the window's width it will return 0. |
Sorry for me being a bit late on this. |
This will hang the application if called before dpg.start_dearpygui(). Any other suggestions? |
Version of Dear PyGui
Version: 0.8.64 on Python 3.7
Operating System: Scientific Linux 7.4
My Issue/Question
When using the node editor, nodes set their shape based on their child items. I want to be able to poll what the shape is, which will allow me to start positioning nodes sensibly when they are programmatically created.
Generally speaking, you can use
dpg.get_item_pos
,dpg.get_item_width
/dpg.get_item_height
anddpg.get_item_rect_min
/dpg.get_item_rect_max
to get this sort of information about any DearPyGui item.However, for nodes, the width and height always return zero and the rect min and max are always equal. (They are also different from
dpg.get_item_pos
and I don't know if that is a bug or a feature based on the rect covering different elements than the pos...)To Reproduce
Run the example below. Press the button in the window and observe the unhelpful values returned by the various relevant calls for properties of the node.
Expected behavior
I would expect
dpg.get_item_pos
anddpg.get_item_rect_min
to return the pixel position of the top right of the node in the node editor coordinates,dpg.get_item_width
anddpg.get_item_height
to give the pixel width and height of the node anddpg.get_item_rect_max
to equaldpg.get_item_rect_min + (dpg.get_item_width, dpg.get_item_height)
.Standalone, minimal, complete and verifiable example
The text was updated successfully, but these errors were encountered: