# splitEllipse4.py
from Processing import *
window(500, 500)

def drawEllipse(o, e):
    x, y = mouseX(), mouseY()
    w, h = width(), height()

    if x > 0.5*w:
        if y > 0.5*h:
            fill(255, 0, 0)     # Red: on lower right
        else:
            fill(0, 0, 255)     # Blue: lower left
    elif x <= 0.5*w:
        if y > 0.5*h:
            fill(255, 255, 0)   # Yellow: upper right
        else:
            fill(0, 255, 0)     # Green upper left

    ellipse(x, y, 30, 30)

onMousePressed += drawEllipse
