Drawing A Yellow Rectangle

Python, PyGame on Linux and Windows

This solution requires a Python interpreter and the PyGame library.

Built on top of Simple DirectMedia Layer (SDL), PyGame supports a variety of display environments on multiple operating systems. The program has been successfully tested on these systems:

  • Devuan GNU/Linux 1.0 on a PC with Xorg,
  • Debian GNU/Linux 9.0 on a Banana Pi framebuffer and
  • MS Windows 10.
#!/usr/bin/env python
"""Draw a yellow rectangle."""

from pygame import display, draw, event, init, time, FULLSCREEN
from pygame.locals import KEYDOWN, QUIT

screen = display.set_mode((640, 480), FULLSCREEN)


draw.rect(screen, (255, 255, 0), (10, 20, 100, 75), 0)

while True:
    for e in event.get():
        if e.type == QUIT or e.type == KEYDOWN: