Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # If you put one or more widget into a Box, does this change the layout? J.Warr 19/08/202
- from guizero import *
- # this time we have not set the layout to auto as it is default
- app = App(title="align", width="400", height="200", bg="black")
- top = Box(app, align="top", width="fill")
- top.bg="cyan"
- bottom = Box(app, align="bottom", width="fill")
- bottom.bg="yellow"
- left = Box(app, align="left", width="fill")
- left.bg="pink"
- right = Box(app, align="right", width="fill")
- right.bg="lightgreen"
- # create a series of widgets each with a different alignment
- top_text = Text(top, text="at the top", align="bottom")
- top_button = PushButton(top, text="Top", align="top")
- top_button.bg="yellow"
- bottom_text = Text(bottom, text="at the bottom", align="top")
- bottom_button = PushButton(bottom, text="Bottom", align="bottom")
- bottom_button.bg="cyan"
- left_button = PushButton(left, text="Left", align="left")
- left_text = Text(left, text="to the left", align="left")
- left_button.bg="lightgreen"
- right_button = PushButton(right, text="Right", align="right")
- right_text = Text(right, text="to the right", align="right")
- right_button.bg="pink"
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment