def track_scrollbar(track_events_to, direction, *args):
    """Writes all details necessary to reproduce a scrollbar event to a file.

    Called at each use of the scroll bar if the track_events_to variable of the CircuitEditor is not None.
    
    An x scrolling event will be stored as:
    #x, 'moveto', '-0.2517763964891542'

    And a y scrolling event will be stored as:
    #y, 'moveto', '0.07237927963277839'
    
    Parameters
    ----------
    track_events_to:    string
                        name (or path) of the folder to write to
    direction:          string
                        Either 'x' or 'y'
    args:               List of strings
                        Automatically generated by a ttk.Scrollbar method:
                        ['moveto','<float>']
                        
    """
    event_string = ''
    event_string += '#' + direction
    for a in args:
        event_string += ', ' + repr(a)
    with open(track_events_to, 'a+') as event_tracking_file:
        event_tracking_file.write(event_string + '\n')
