crzcas

align widgets

Mar 7th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. # create a series of widgets each with a different alignment
  2. from guizero import App, PushButton, Text, Box
  3.  
  4. app = App(title="align")
  5.  
  6. title_box = Box(app, width="fill", align="top", border=True)
  7. title_box.bg = "blue"
  8. top_text = Text(title_box, text="at the top", align="top")
  9. top_text.bg = "yellow"
  10. footer_box = Box(app, width="fill", align="bottom", border=True)
  11. footer_box.bg = "orange"
  12. bottom_text = Text(footer_box, text="at the bottom", align="bottom")
  13. bottom_text.bg = "green"
  14. left_box = Box(app, width="fill", align="left", border=True)
  15. left_box.bg = "aqua"
  16. left_text = Text(left_box, text="to the left", align="left")
  17. left_text.bg = "pink"
  18. left_text_1 = Text(left_box, text="to the left again", align="left")
  19. left_text_1.bg = "gray"
  20. right_box = Box(app, width="fill", align="right", border=True)
  21. right_box.bg = "purple"
  22. right_text = Text(right_box, text="to the right", align="right")
  23. right_text.bg = "silver"
  24.  
  25. app.display()
Advertisement
Add Comment
Please, Sign In to add comment