1

I'm writing a file management and config file editing app in Python 3.10 with Dear PyGui as the GUI library. I would like to place a group at the bottom of the window so it:

  1. Stays at the same place when the rest of the content in the window changes
  2. Stays at the same place relative to the lower left (or right) screen corner when the user changes the size of the viewport

I know how to do 1, I can just use pos=(10, dpg.get_viewport_height()-75). I don't know how to do 2. The above seems to do it upon launch and if you don't resize the viewport, but it doesn't actually anchor them to that relative spot as the window size changes:

stock window size smaller window size

ohyeah2389
  • 25
  • 4

1 Answers1

0

To anchor the group to the bottom, you need to update its position on the window resize. Dear PyGui has a callback that fires every time the window is resized: dpg.set_viewport_resize_callback(update) where update is a function that, in this case, runs dpg.set_item_pos("bottom_buttons", (10, dpg.get_viewport_height()-75)). This will keep the buttons positioned at the bottom of the screen.

There might be a better way to do this, and doing it this way might have consequences for overlapping content later on, but it's the easiest way to implement it that I have tried.

ohyeah2389
  • 25
  • 4