Widget history

Store a fixed number of stored states in-memory


source

WidgetStateHistory

 WidgetStateHistory (history_size:int=5)

Initialize self. See help(type(self)) for accurate signature.

widget_states = WidgetStateHistory(history_size=5)

widget_states["widget_1"] = {"value": 10}
widget_states["widget_1"] = {"value": 20}
assert len(widget_states) == 1
assert widget_states['widget_1'] == {"value": 20}

del widget_states["widget_1"]    
assert len(widget_states) == 0