"Exit Game"-Button

I’m trying to get one of the buttons in my game’s main menu to exit the game when clicked. No matter where I looked I couldn’t find anythin that would give me an idea of how to do it.
Finally I found a function when looking through the code of some of the games I’ve got installed on my computer.
It works and gets the job done, but I don’t understand how it does it. I’d really like to know and I haven’t found anything about it so far.

def shutdown():
    """
    Perform any cleanup actions in the logging system (e.g. flushing
    buffers).

    Should be called at application exit.
    """
    for h in _handlers.keys():
        h.flush()
        h.close()

I’d really apreciate it if someone could explain to me just how this function works and more precisely what it actually does.

I don’t know what the heck that function is doing. The normal way to exit Python is just to call sys.exit().

David

hm… flushin buffers etc should only be neccessary if you’r manually writing to files on your harddisk, and even if you dont flush them manually they are supposed to be flushed automatically if the application closes. just like drwr said, it makes no sense.
calling sys.exit() never failed me.

Thanks a lot, guys!