that can easily be change as Python can readily be read down (although I consider this standard)
def swap_rows(self, row1, row0=None):
"""
Swap any two rows in a GridBagSizer.
"""
if row0 is None and self.row_selected is not None:
row0 = self.row_selected
def str_int(row):
if not isinstance(row, str|int):
return -1
if isinstance(row, str):
row = int(row) if row.isnumeric() else -1
if row < 0 or row > self.GetRows() - 1:
row = -1
return row
if (row0 := str_int(row0)) < 0 or (row1 := str_int(row1)) < 0:
return
# swap
# self.deselect()
self.row_selected = row1
w0 = []
w1 = []