-
Is there a way to set child widget width to fill all the available parent width? For example, for a text input to have the width of its parent window? I figured that I can query the window width inside render loop and assign this value to the widget of interest (minus double window padding and scrollbar size) on every iteration: while dpg.is_dearpygui_running():
windowWidth = dpg.get_item_width("windowID")
dpg.set_item_width(
"textInputID",
windowWidth - (8 * 2 + 14) # better to get these variables from the theme
)
dpg.render_dearpygui_frame() Is that the way? Seems like a bit of an overkill. Additionally, is there a variable/flag to check whether window's scrollbar is not visible/shown, so there is no need to subtract its width? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @retifrav, What you are looking for is By the way, the same applies to dpg.add_input_text(default_value="Input text using full parent width", width=-1) Please also have a look to the dearpygui integrated demo (Layout & Scrolling): import dearpygui.demo as dpd
...
dpd.show_demo() It seems that up to now, nowhere else in the documentation this "-1" size policy is mentioned explicitly. |
Beta Was this translation helpful? Give feedback.
Hi @retifrav,
What you are looking for is
width=-1
By the way, the same applies to
height=-1
, but not all widgets support that size policy.Please also have a look to the dearpygui integrated demo (Layout & Scrolling):
It seems that up to now, nowhere else in the documentation this "-1" size policy is mentioned explicitly.