How do I output recorded events directly to a.CSV file instead of a.raw file

How do I output recorded events directly to a.CSV file instead of a.raw file

I'm using python.
I saw the simple_recorder routine and the raw_to_csv routine in the python example.
But I had a problem when I tried to combine the functionality of these two routines (to display camera contents through a window and output a csv file directly, skipping the process of generating the.raw file).
I'm not sure what code I should use to get the camera-generated event, or how I should implement the function I want.
Any help you can provide will be greatly appreciated.
    As a Prophesee customer, join the community conversation. 
    Request your free access today.