# This program contains a mirror method that flips the appearance # of a DrawingPanel horizontally pixel-by-pixel. from DrawingPanel import * # Horizontally flips the pixels of the given drawing panel. def mirror(panel): px = panel.pixels for x in range(panel.width // 2): for y in range(panel.height): # swap with pixel at "mirrored" location opposite = panel.width - 1 - x temp = px[x][y] px[x][y] = px[opposite][y] px[opposite][y] = temp panel.pixels = px def main(): panel = DrawingPanel(300, 200) panel.fill_oval(20, 100, 30, 70) panel.draw_rectangle(20, 50, 80, 30) mirror(panel) main()