Skip to content
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

Padding and Margins or positioning for Box #361

Open
gmeader opened this issue Apr 10, 2020 · 2 comments
Open

Padding and Margins or positioning for Box #361

gmeader opened this issue Apr 10, 2020 · 2 comments

Comments

@gmeader
Copy link

gmeader commented Apr 10, 2020

Problem:
It is not possible to create a layout that has boxes spaced apart the way they are shown in the hand-drawn image at the bottom of the https://lawsie.github.io/guizero/layout/ documentation page.
This is because the layout sticks the Box right next to the Window/App container or grid edges. A Box cannot be positioned absolutely within a container, and/or it does not have margin or padding attributes (see CSS)

Solution:
Give Box padding and/or margin attributes similar to how they work in CSS in a web browser.
An alternative is to provide absolute positioning within the container (app) with top and left attributes. Maybe adding a new layout type (besides auto and grid) that would enable absolute positioning of widgets.

Alternative:
One could use a grid with extra "empty" rows and columns that would be used to put padding space between Boxes.

@martinohanlon
Copy link
Collaborator

Alternatively Box's can be used for padding.

e.g. create a 5 pixel pad to the left of the app window.

app = App()
left_pad = Box(app, align="left", height="fill", width=5)

@martinohanlon
Copy link
Collaborator

I need to do some invesigation into how padding works. Most widgets seem to allow padding in the config as padx, pady. You also seem to be able to provide padding data when positioning the widget using .pack and .grid e.g. .pack(padx = 10).

This thread also suggests you can pass a tuple as define different values for left, right, top, bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants