Advertisement
mrFitzpatrick

TonganFlagRemixed

Aug 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1. from guizero import App, Text, Box, PushButton, TextBox
  2.  
  3. app = App()
  4.  
  5. # Divide the flag into two sections, a top layer containing the cross and a red block
  6. # and a bottom, red layer.
  7.  
  8. top = Box(app, align="right", width="fill")
  9. bottom = Box(app, width="fill", height="fill")
  10.  
  11. # Create a box to contain the cross, aligned left in the top layer.
  12. #Changed alignment to "top", which was a mistake!
  13. cross = Box(top, align="top")
  14.  
  15. # Two boxes are needed to construct the cross.
  16. flag = Box(cross)
  17. # Set the background to white.
  18. flag.bg = "white"
  19.  
  20. #setting flag box to fill height, has no additional effect
  21. flag.height = "fill"
  22.  
  23. # Make the upper parts of the cross out of four equal sized, red blocks.
  24. first = Text(flag, bg="red", align="left", height=1, width=3)
  25. second = Text(flag, bg="red", align="left", height=1, width=3)
  26. third = Text(flag, bg="red", align="left", height=1, width=3)
  27. fourth = Text(flag, bg="red", align="left", height=1, width=3)
  28. # Create the second box directly below the first, so that the final piece
  29. # of the cross will be added to the bottom of the cross. Try running the
  30. # program without this box to see where it would automatically be placed.
  31. flag_cont = Box(cross)
  32. # Set the background to white
  33. flag_cont.bg = "white"
  34. # Complete the flag
  35. fifth = Text(flag_cont, height=1, width=3, align="bottom", bg="red")
  36.  
  37. # Fill in the rest of the flag red
  38. fill = Text(top, align="left", height="fill", width="fill", bg="red")
  39. fill_cont = Text(bottom, height="fill", width="fill", bg="red")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement