def getMouseEvent():
    global oldbutt
    global pin
    buf = file.read(3)
    pin = (pin & 7)
    button = (ord(buf[0]) & pin)
    if (button != oldbutt):
        oldbutt = button
        print(button)
def getMouseEvent():
    global oldbutt
    global pin
    buf = file.read(3)
    pin = (pin & 7)
    button = (ord(buf[0]) & pin)
    if (button != oldbutt):
        oldbutt = button
        print(button)