Open Riddle1001 opened 2 years ago
In these cases, it usually takes a frame for all values to be updated. If you would check in the next frame, it might show the appropriate value.
Retrieving item size in ImGui is only possible after the item renders at least once. For windows, however, it usually takes two frames to auto-size to content size:
That said, your request, as it is, is impossible to implement. I'd suggest that this ticket be closed.
Whenever you need to retrieve the size of an auto-sized widget, like a window or a table, wait a frame or two and then use dpg.get_item_rect_min(widget)
. If you're creating the widget on-the-fly (not at program initialization), you can use dpg.split_frame()
for that. Alternatively, you can use set_frame_callback
or use the item_visible
handler; this works for widgets created at init, too.
Is your feature request related to a problem? Please describe. I would like
not to return
0
. Describe the solution you'd like Whenautosize_x
isTrue
set the item configuration width and height properties to the calculated width and height properties instead of0
Describe alternatives you've considered