Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, Box, PushButton, TextBox
- app = App()
- # Divide the flag into two sections, a top layer containing the cross and a red block
- # and a bottom, red layer.
- flags = Box(app, height = "fill", width = "fill")
- top = Box(flags, align="top", width="fill", height = "fill")
- bottom = Box(flags, align = "bottom", width="fill", height="fill")
- # Create a box to contain the cross, aligned left in the top layer.
- cross = Box(top, align="top", height = "fill", width = "fill")
- # Two boxes are needed to construct the cross.
- flag = Box(cross)
- # Set the background to white.
- flag.bg = "white"
- # Make the upper parts of the cross out of four equal sized, red blocks.
- first = Text(flag, bg="red", align="top", height=1, width=3)
- second = Text(flag, bg="red", align="left", height=1, width=3)
- third = Text(flag, bg="red", align="left", height=1, width=3)
- fourth = Text(flag, bg="red", align="left", height=1, width=3)
- # Create the second box directly below the first, so that the final piece
- # of the cross will be added to the bottom of the cross. Try running the
- # program without this box to see where it would automatically be placed.
- flag_cont = Box(cross)
- # Set the background to white
- flag_cont.bg = "white"
- # Complete the flag
- fifth = Text(flag_cont, bg="white", align="left", height=1, width=3)
- sixth = Text(flag_cont, bg="red", align="left", height=1, width=3)
- seventh = Text(flag_cont, bg="white", align="left", height=1, width=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement