hoffstadt / hoffstadt/DearPyGui
How to set height for listbox
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm trying to make a template for a two pane file manager, but I can't seem to stretch the listbox all the way down.
I have -
```python
import ctypes, platform
import dearpygui.dearpygui as dpg
from subprocess import Popen, PIPE
dpg.create_context()
dpg.set_global_font_scale(3)
# dpg.show_style_editor()
if platform.system() == "Windows":
user32 = ctypes.windll.user32
screen_width, screen_height = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
elif platform.system() == "Linux":
output = Popen('xrandr | grep "\*" | awk \'{print $1}\'',shell=True, stdout=PIPE).communicate()[0]
resolution = output.strip().split(b'x')
screen_width, screen_height = int(resolution[0]), int(resolution[1].split(b'\n')[0])
else:
screen_width, screen_height = 800, 600
dpg.create_viewport(title='Custom Title', width=screen_width, height=screen_height)
with dpg.window(label='Dual Pane File Manager', width=screen_width, height=screen_height):
with dpg.group(): #optional group for better layout
dpg.add_text('Left Panel')
with dpg.child_window(width=screen_width // 2, height = screen_height - 40):
listbox_tag = dpg.generate_uuid()
listbox = dpg.add_listbox(items=('check', '1', '2', '3', '4'),
tag=listbox_tag)
# dpg.set_item_height(listbox, screen_height - 40)
# dpg.set_item_height(listbox_tag, screen_height - 40)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```
It seems that `listbox` doesn't support height, and I was unable to make `dpg.set_item_height()` work either.
Is there a way to make a `listbox` use up all the height available by its container?
Thanks,
Eli
Contributor guide
Assessment
This issue has not been assessed yet.