I'm currently using PYQT5 to create a simple GUI. I've created a qtablewidget using QTDesigner where the user can group people. The data is imported into the GUI with the Name, Start, End, and Class columns completed and locked for editing. The user enters numbers starting with "1" to group the people. Below is an example of the table.

TableEx.jpg

As the user groups the people I need to create a nested list, or list of lists. Each of the lower lists will contain the indexes for each person in the group. So in the example groupings = [[0,1],[2,3]].

Based on the pyqt documentation it looks like I should use the getitem() function but I'm unsure how exactly to construct the iteration to retrieve the indexes and group them.

Any suggestions would be greatly appreciated.