Fred Agbo
September 28, 2026
bR9Zoo

from pgl import GWindow, GRect, GLabel
"""
Algorithm:
Make a bunch of box with text in them
Assign each box a location, and add it
"""
def make_and_place_box(word, x, y):
"""Make a box with the desired word centered in it
Algorithm:
Make a box of the desired dimensions
Make a label with the text
Center that label in the box
Add everything to the window
"""
box = GRect(x, y, BOX_WIDTH, BOX_HEIGHT)
label = GLabel(word.upper())
label.set_font("bold 20pt sans-serif")
new_x = x + BOX_WIDTH / 2 - label.get_width() / 2
new_y = y + BOX_HEIGHT / 2 + label.get_ascent() / 2
gw.add(box)
gw.add(label, new_x, new_y)
BOX_WIDTH = 200
BOX_HEIGHT = 100
BOX_SEP = 10
WIDTH = 4 * (BOX_WIDTH + BOX_SEP)
HEIGHT = 4 * (BOX_HEIGHT + BOX_SEP)
gw = GWindow(WIDTH, HEIGHT)
# Row 1
make_and_place_box('wayne',
BOX_SEP / 2,
BOX_SEP / 2)
make_and_place_box('parliament',
BOX_SEP / 2 + (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2)
make_and_place_box('standard',
BOX_SEP / 2 + 2 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2)
make_and_place_box('lesson',
BOX_SEP / 2 + 3 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2)
# Row 2
make_and_place_box('kent',
BOX_SEP / 2,
BOX_SEP / 2 + (BOX_HEIGHT + BOX_SEP))
make_and_place_box('sync',
BOX_SEP / 2 + (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + (BOX_HEIGHT + BOX_SEP))
make_and_place_box('sheer',
BOX_SEP / 2 + 2 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + (BOX_HEIGHT + BOX_SEP))
make_and_place_box('colors',
BOX_SEP / 2 + 3 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + (BOX_HEIGHT + BOX_SEP))
# Row 3
make_and_place_box('stark',
BOX_SEP / 2,
BOX_SEP / 2 + 2 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('camel',
BOX_SEP / 2 + 1 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 2 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('banner',
BOX_SEP / 2 + 2 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 2 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('utter',
BOX_SEP / 2 + 3 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 2 * (BOX_HEIGHT + BOX_SEP))
# Row 4
make_and_place_box('reseed',
BOX_SEP / 2,
BOX_SEP / 2 + 3 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('pure',
BOX_SEP / 2 + 1 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 3 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('flag',
BOX_SEP / 2 + 2 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 3 * (BOX_HEIGHT + BOX_SEP))
make_and_place_box('salem',
BOX_SEP / 2 + 3 * (BOX_WIDTH + BOX_SEP),
BOX_SEP / 2 + 3 * (BOX_HEIGHT + BOX_SEP))
Prob1.py in today’s contents contains
four different poorly constructed predicate functionsTrue and
False should not show up in the function
anywhereProb2.py contains a basic function
definition to create and print a sandwich to the screenmake_sandwich function header to create
those defaults