Python3 & Tkinter, list.sort list of objects made of StringVar Python3 & Tkinter, list.sort list of objects made of StringVar tkinter tkinter

Python3 & Tkinter, list.sort list of objects made of StringVar


You didn't quite get the syntax right for the lambda. You need an argument and a colon. Try:

list.sort(Action._registry, key=lambda item: item.__dict__['date'].get())

Additional style tip: it is idiomatic to call sort as a method of the object you're sorting, rather than literally doing list.sort.

Action._registry.sort(key=lambda item: item.__dict__['date'].get())